MagicApp\AppEntityDateTime
Declaration
Package
MagicAppDescription
Class AppEntityDateTime
This class is used to handle date and time values related to a specific entity. It takes care of converting date and time values into a formatted string while considering time zones and translation maps for the application. It also offers the ability to get various date and time properties dynamically from the entity.
Properties
Declaration
Description
The entity that this class is associated with.
Declaration
Description
The time zone used for converting and formatting dates and times.
Declaration
Description
The default format used for formatting date and time.
Declaration
Description
The default format used for formatting dates (without time).
Declaration
Description
A translation map used to replace certain substrings in the formatted date/time strings.
Methods
Declaration
MagicObject $entity,
array|null $translationMap = null,
string $defaultDateTimeFormat = 'Y-m-d H:i:s',
string $defaultDateFormat = 'Y-m-d'
)
{
}
Description
AppEntityDateTime constructor.
This constructor initializes the object with the necessary entity and options such as default date formats and the translation map for replacing parts of the formatted date/time. It also sets the time zone based on the entity's database settings.
Parameters
The entity this class is responsible for.
Optional map for translating date/time strings.
The default format for date and time.
The default format for date (without time).
Declaration
mixed $dateTime,
string|null $format = null
) : string|null
{
}
Description
Converts a DateTime object or string into a formatted string.
This method takes a DateTime object or a string and converts it into a formatted date/time string. The resulting string is also adjusted to the object's time zone if necessary. If a translation map is provided, it will replace specific substrings in the formatted string.
Parameters
The DateTime object or string to be converted.
The format in which the date/time should be returned. If not provided, defaults are used.
Return
The formatted date/time string.
Declaration
string $method,
array $arguments
) : string|null
{
}
Description
Magic method to dynamically get properties from the entity.
This method intercepts calls to getter methods for the entity's properties and formats the result as a date/time string based on the available formats and time zone settings. It will return the formatted date/time string for the corresponding property or null if the property is not set.
Parameters
The name of the called method.
The arguments passed to the method.
Return
The formatted date/time string or null.
Declaration
{
}
Description
Convert the object to a string representation.
This method converts the object into a JSON-encoded string containing key information about the object, including the time zone, date formats, translation map, and the entity name.
Return
JSON-encoded string containing object information.
MagicApp\AppEntityLanguage
Declaration
Description
Class AppEntityLanguage
This class extends PicoEntityLanguage to manage language-specific configurations for application entities. It handles loading language data from INI files based on the current language setting and the application's configuration.
Constants
Properties
Declaration
Description
App config
Declaration
Description
Current language
Declaration
Description
Full class name of the entity
Declaration
Description
Base class name of the entity
Declaration
Description
Base language directory path
Methods
Declaration
MagicObject $entity,
SecretObject $appConfig,
string $currentLanguage
)
{
}
Description
Constructor
Initializes the AppEntityLanguage with the entity, app configuration, and the current language. It loads the corresponding language values.
Parameters
The entity whose language needs to be loaded
The application configuration
The current language code
Declaration
MagicObject $entity,
SecretObject $appConfig,
string $currentLanguage
) : MagicObject
{
}
Description
Load entity language from an INI file based on the entity and config.
Parameters
The entity to load language for
The application configuration
The current language code
Return
The loaded language values as a MagicObject
Declaration
string $className,
string|null $prefix,
int $parent = 0
) : string
{
}
Description
Extracts the base class name from a full class name, optionally using a prefix and accounting for parent classes.
Parameters
The full class name
An optional prefix to remove
Number of parent classes to consider
Return
The base class name
Declaration
{
}
Description
Get the application configuration.
Return
The application configuration object
Declaration
{
}
Description
Get the current language code.
Return
The current language code
Declaration
MagicObject $entity
) : self
{
}
Description
Load data into the object from the given entity.
Parameters
The entity to load.
Return
Returns the current instance for method chaining.
Declaration
string $code,
object|stdClass|array $reference,
bool $use = false
) : self
{
}
Description
Add a language to the entity.
Parameters
Language code.
Reference data for the language.
Flag to indicate whether to use this language immediately.
Return
Returns the current instance for method chaining.
Declaration
string $code
) : self
{
}
Description
Remove a language from the entity.
Parameters
Language code to remove.
Return
Returns the current instance for method chaining.
Declaration
string $code
) : self
{
}
Description
Set the current language.
Parameters
Language code to set as current.
Return
Returns the current instance for method chaining.
Declaration
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the entity.
Parameters
Flag to determine if result should be returned as an array.
Return
List of properties.
Declaration
PicoAnnotationParser $reflexProp,
PicoGenericObject $parameters,
string $annotation,
string $attribute
) : mixed|null
{
}
Description
Get the content of a specific annotation.
Parameters
Property reflection object.
Parameters associated with the property.
Annotation name to search for.
Attribute name to retrieve.
Return
Declaration
PicoAnnotationParser $reflexProp,
PicoGenericObject $parameters,
string $defaultLabel
) : string
{
}
Description
Define the label for a property.
Parameters
Property reflection object.
Parameters associated with the property.
Default label to use if no annotation is found.
Return
The defined label.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
Name of the property to set.
Value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
Name of the property to get.
Return
The value of the property or null if not set.
Declaration
string $name
) : mixed
{
}
Description
Magic method to get property values.
Example:
<?php
echo $instance->foo;
Parameters
Name of the property to get.
Return
Value of the property if set, otherwise null.
Declaration
string $name
) : bool
{
}
Description
Check if a property is set or not.
Parameters
Name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $method,
array $args
) : mixed|null
{
}
Description
Magic method to handle undefined methods.
This method allows for the dynamic handling of method calls that are not explicitly defined in the class. Specifically, it processes calls to getter methods that start with the prefix "get".
When a method starting with "get" is invoked, this method extracts the property name
from the method name and calls the get method to retrieve the corresponding value.
Supported dynamic getter methods:
-
get<PropertyName>: This will call thegetmethod with the property name derived from the method call. For example, calling$obj->getAge()would result in a call to$this->get('age').If the method name does not start with "get" or does not correspond to a valid property, this method will return
null.
Parameters
Name of the method being called, expected to start with "get".
Arguments passed to the method; typically unused in this context.
Return
The value of the requested property if it exists; otherwise, null.
Declaration
{
}
Description
Get the table identity.
Return
The table identity object.
Declaration
{
}
Description
Get the entity language code.
Return
The entity language code.
Declaration
{
}
Description
Get the entity class name.
Return
The entity class name.
Declaration
{
}
Description
Converts the object to its string representation.
This method checks if the label language and current language are set. If they are, it returns the JSON-encoded string of the label corresponding to the current language. If not, it returns an empty JSON object.
Return
A JSON-encoded string of the label for the current language,
Declaration
{
}
Description
Get the value of defaultLabel
Return
Get default label of the entity
MagicApp\AppFormBuilder
Declaration
Description
Class AppFormBuilder
This class provides methods for building form elements, specifically select options, by fetching data from a MagicObject entity. It handles the creation of select elements with options based on specified criteria, including attributes and selection states.
Methods
Declaration
{
}
Description
Get an instance of the AppFormBuilder class.
Return
A new instance of AppFormBuilder
Declaration
MagicObject $entity,
PicoSpecification $specification,
PicoSortable $sortable,
string $primaryKey,
mixed $valueKey,
mixed|null $currentValue = null,
string[]|null $additionalOutput = null
) : AppFormSelect
{
}
Description
Create select options for a form element.
This method retrieves data from the specified entity using the given specification and sorting parameters. It then builds a select option list based on the retrieved data, marking the current value as selected if applicable.
Parameters
The entity to fetch data from
The specification for the query
The sorting parameters for the results
The key used for the option values
The key used for the option labels
The currently selected value (if any)
Additional attributes to include in each option
Return
The created select option element
Declaration
MagicObject $entity,
PicoSpecification $specification,
PicoSortable $sortable,
string $primaryKey,
mixed $valueKey,
mixed|null $currentValue = null,
string[]|null $additionalOutput = null
) : AppJsonLabelValue
{
}
Description
Create select options for a form element.
This method retrieves data from the specified entity using the given specification and sorting parameters. It then builds a select option list based on the retrieved data, marking the current value as selected if applicable.
Parameters
The entity to fetch data from
The specification for the query
The sorting parameters for the results
The key used for the option values
The key used for the option labels
The currently selected value (if any)
Additional attributes to include in each option
Return
The select option data
Declaration
string[]|null $additionalOutput,
MagicObject $row
) : string[]
{
}
Description
Create attributes from additional output keys.
This method retrieves specified attributes from a given row and constructs an associative array of attributes to be used in form options.
Parameters
Array of additional attribute keys
The current row from which to extract attribute values
Return
An associative array of attributes
Declaration
mixed $param1,
mixed $param2
) : string
{
}
Description
Return 'selected="selected"' if the two parameters are equal.
This method is a utility to generate the selected attribute for HTML options.
Parameters
The first parameter for comparison
The second parameter for comparison
Return
The attribute string if parameters match, empty string otherwise
Declaration
mixed $param1,
mixed $param2
) : string
{
}
Description
Return 'checked="checked"' if the two parameters are equal.
This method is a utility to generate the checked attribute for HTML inputs.
Parameters
The first parameter for comparison
The second parameter for comparison
Return
The attribute string if parameters match, empty string otherwise
Declaration
bool $div
) : string
{
}
Description
Add class compare data based on a boolean flag.
This method returns a CSS class string indicating whether the data is different or not based on the given boolean parameter.
Parameters
The boolean flag indicating data comparison
Return
The class string for comparison
MagicApp\AppFormOption
Declaration
Description
Class AppFormOption
Represents an option within a form element, encapsulating the necessary attributes and behaviors associated with that option, including its display text, value, selection state, and any additional data attributes.
Properties
Declaration
Description
Text node for the option.
Declaration
Description
Value associated with the option.
Declaration
Description
Indicates whether the option is selected.
Declaration
Description
Additional attributes for the option.
Declaration
Description
Format for the text node, allowing dynamic content.
Declaration
Description
Parameters for dynamic formatting of the text node.
Declaration
Description
Data associated with the option, typically from a MagicObject.
Declaration
Description
Padding to format the output, e.g., for nested options.
Methods
Declaration
string $label,
string|null $value = null,
boolean $selected = false,
string[]|null $attributes = null,
MagicObject|null $data = null
)
{
}
Description
Constructor to initialize the option with text, value, selected state, attributes, and data.
Parameters
The display text for the option
The value of the option
Indicates if the option is selected
Additional HTML attributes for the option
Associated data for dynamic value retrieval
Declaration
{
}
Description
Create HTML data attributes for the option.
This method generates a string of HTML data attributes from the attributes array.
It formats each key into a data- attribute (e.g., data-attribute-name="value").
Return
Formatted string of data attributes for HTML
Declaration
string $format,
string[] $params
) : self
{
}
Description
Set a format for the text node with parameters for dynamic content.
This method allows you to set a dynamic format for the text of the option. The format string can contain placeholders that will be replaced with the provided parameters.
Parameters
The format string
The parameters for the format
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Retrieve the values of the parameters used in the format.
This method returns an array of parameter values by evaluating each one
through the getValue() method, which may fetch data from the associated MagicObject.
Return
Array of parameter values
Declaration
string $param
) : string|null
{
}
Description
Get the value associated with a given parameter.
This method retrieves the value of a parameter, which could be a property
of the associated MagicObject (if it exists) or simply the parameter name.
Parameters
The parameter name
Return
The value associated with the parameter, or null if not found
Declaration
string $pad = ' '
) : self
{
}
Description
Set padding for the option, typically for nested structures.
This method allows you to specify padding to be applied to the option, typically useful for nested option elements.
Parameters
The padding string (default is a tab character)
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the HTML representation of the option as a string.
This method generates the HTML markup for the option element. It includes the value, display text, selection state, and any additional attributes.
Return
The HTML option element
Declaration
{
}
Description
Alias for the __toString() method.
This method is an alias for __toString() to provide a more intuitive
method name for rendering the option as a string.
Return
The HTML option element
Declaration
{
}
Description
Get the text node for the option.
This method retrieves the text content associated with the option.
Return
The text node
Declaration
string $label
) : self
{
}
Description
Set the text node for the option.
This method allows setting a new text value for the option.
Parameters
The text node to set
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the associated data for the option.
This method retrieves the associated MagicObject that holds additional data
for dynamic value retrieval.
Return
The associated data object, or null if not set
Declaration
{
}
Description
Get additional attributes for the option.
This method returns the additional attributes that are associated with the option. These attributes could be HTML attributes or any custom metadata assigned to the option.
Return
An associative array of attributes, or null if no attributes are set.
Declaration
array|null $attributes
) : self
{
}
Description
Set additional attributes for the option.
This method allows you to assign additional attributes to the option. These can be any valid HTML attributes or custom data attributes you wish to associate with the option.
Parameters
An associative array of attributes to set, or null to clear attributes.
Return
The current instance of the class, allowing for method chaining.
MagicApp\AppFormSelect
Declaration
Description
Class AppFormSelect
Represents a select form element that can contain multiple options. Provides methods to add options, set formatting, and generate the HTML representation of the select element.
This class helps in managing and rendering a <select> HTML element with various options. It allows you to
dynamically add options, format the text of the options, and generate the HTML representation of the select element.
Properties
Declaration
Description
Array of options for the select element.
Methods
Declaration
string $label,
string|null $value = null,
boolean $selected = false,
string[]|null $attributes = null,
MagicObject|null $data = null
) : self
{
}
Description
Add an option to the select element.
This method adds a new option to the select element, which consists of display text, a value, a selected status, optional HTML attributes, and associated data.
Parameters
The display text for the option
The value of the option
Indicates if the option is selected
Additional HTML attributes for the option
Associated data for the option
Return
The current instance, allowing method chaining
Declaration
callable|string $format
) : self
{
}
Description
Set the text node format for all options.
This method allows you to set a format for the display text (text node) of each option in the select element. You can provide a format string or a callable function that will be applied to the associated data for each option.
Parameters
A callable function or a format string
Return
The current instance, allowing method chaining
Declaration
string $format
) : self
{
}
Description
Set the text node format using a format string.
This method allows you to set the format for the text of each option by using a format string.
The format string can contain placeholders like %s and %d to be replaced with values from the option's data.
Parameters
The format string
Return
The current instance, allowing method chaining
Declaration
integer $indent = 1
) : self
{
}
Description
Set indentation for the options.
This method sets the level of indentation for each option's HTML representation.
The indent parameter determines how many tab characters will be used for indentation.
Parameters
The level of indentation (default is 1)
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the HTML representation of the select element as a string.
This method generates the complete HTML representation of the <select> element, including all of its options.
The options are rendered using their respective toString() method.
Return
The HTML representation of the select element, including options
MagicApp\AppInclude
Declaration
Description
Class AppInclude
Manages the inclusion of application components such as headers, footers, and error pages. It provides methods to dynamically retrieve the paths to these components based on the application's configuration.
This class is responsible for generating the file paths for common application components such as the header, footer, and error pages. It also allows dynamic configuration based on the application's settings and the current module.
Properties
Declaration
Description
Application configuration.
Declaration
Description
Application instance.
Declaration
Description
Current module in use.
Methods
Declaration
SecretObject $appConfig,
PicoModule $currentModule
)
{
}
Description
AppInclude constructor.
Initializes the AppInclude object with the application configuration and the current module. If no application is set, a new SecretObject instance is created for the app.
Parameters
The application configuration object.
The current module being used.
Declaration
string $dir
) : string
{
}
Description
Get the path to the main header file.
Retrieves the file path for the main header. If a custom header path is defined in the configuration, it is used, otherwise, a default path is returned.
Parameters
Base directory for includes.
Return
Path to the header file.
Declaration
string $dir
) : string
{
}
Description
Get the path to the main footer file.
Retrieves the file path for the main footer. If a custom footer path is defined in the configuration, it is used, otherwise, a default path is returned.
Parameters
Base directory for includes.
Return
Path to the footer file.
Declaration
string $dir
) : string
{
}
Description
Get the path to the forbidden access page.
Retrieves the file path for the forbidden access page (403). If a custom path is defined in the configuration, it is used, otherwise, a default path is returned.
Parameters
Base directory for includes.
Return
Path to the forbidden page (403).
Declaration
string $dir
) : string
{
}
Description
Get the path to the not found page.
Retrieves the file path for the not found page (404). If a custom path is defined in the configuration, it is used, otherwise, a default path is returned.
Parameters
Base directory for includes.
Return
Path to the not found page (404).
Declaration
{
}
Description
Get the application configuration.
Returns the current application configuration object.
Return
The application configuration.
Declaration
SecretObject $appConfig
) : self
{
}
Description
Set the application configuration.
Allows setting a new application configuration object.
Parameters
The application configuration to set.
Return
The current instance, allowing method chaining.
Declaration
{
}
Description
Get the current module.
Returns the current module that is in use.
Return
The current module.
Declaration
PicoModule $currentModule
) : self
{
}
Description
Set the current module.
Allows setting a new module as the current one.
Parameters
The module to set as current.
Return
The current instance, allowing method chaining.
Declaration
Exception $e
) : string
{
}
Description
Print exception message.
Prints the message of an exception. This method can be used for debugging or logging purposes.
Parameters
The exception to print.
Return
The exception message.
MagicApp\AppJsonLabelValue
Declaration
Package
MagicAppDescription
Class AppJsonLabelValue
Represents a collection of options for a select element in JSON format.
This class allows adding options, retrieving them, and serializing the
collection to JSON. Each option is represented by an instance of the
AppLabelValueData class, which encapsulates details such as label, value,
selected status, and additional data or attributes.
Properties
Declaration
Description
Array of AppLabelValueData objects representing each option.
Methods
Declaration
string $label,
mixed|null $value = null,
bool $selected = false,
mixed|null $attributes = null,
mixed|null $data = null
) : self
{
}
Description
Adds a new option to the options array.
Creates a new instance of AppLabelValueData with the provided details
and appends it to the options array. This method supports method chaining.
Parameters
The label text to display for the option.
The value associated with the option (can be null).
Whether the option should be pre-selected (default: false).
Additional attributes for the option (optional).
Any extra data associated with the option (optional).
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Converts the options collection to a JSON-encoded string.
Iterates over the options array, calling the toJson method on each
AppLabelValueData object, and compiles the results into a JSON string.
Return
A JSON-encoded string representing the options array.
Declaration
{
}
Description
Retrieves the current array of options.
Returns the list of options as an array of AppLabelValueData objects.
Return
The array of options.
Declaration
AppLabelValueData[] $options
) : self
{
}
Description
Sets the options array directly.
Replaces the current options array with the provided array of
AppLabelValueData objects.
Parameters
An array of AppLabelValueData objects.
Return
Returns the current instance for method chaining.
MagicApp\AppLabelValueData
Declaration
Package
MagicAppDescription
Class AppLabelValueData
This class represents an option element for a form, encapsulating the logic to generate
its HTML representation and convert it to JSON format. It extends the AppFormOption class
and allows customization of the option's label, value, selected state, and additional attributes.
It provides methods to generate HTML for the option, as well as to convert the option into a JSON object that includes the label, value, selection state, and attributes.
Methods:
- toJson(): Generates a JSON object representing the option, including label, value, selected state, and attributes.
Properties
Declaration
Description
Text node for the option.
Declaration
Description
Value associated with the option.
Declaration
Description
Indicates whether the option is selected.
Declaration
Description
Additional attributes for the option.
Declaration
Description
Format for the text node, allowing dynamic content.
Declaration
Description
Parameters for dynamic formatting of the text node.
Declaration
Description
Data associated with the option, typically from a MagicObject.
Declaration
Description
Padding to format the output, e.g., for nested options.
Methods
Declaration
{
}
Description
Get the HTML representation of the option as a string.
This method generates the HTML markup for the option element. It includes the value, display text, selection state, and any additional attributes.
Return
The HTML option element
Declaration
string $label,
string|null $value = null,
boolean $selected = false,
string[]|null $attributes = null,
MagicObject|null $data = null
)
{
}
Description
Constructor to initialize the option with text, value, selected state, attributes, and data.
Parameters
The display text for the option
The value of the option
Indicates if the option is selected
Additional HTML attributes for the option
Associated data for dynamic value retrieval
Declaration
{
}
Description
Create HTML data attributes for the option.
This method generates a string of HTML data attributes from the attributes array.
It formats each key into a data- attribute (e.g., data-attribute-name="value").
Return
Formatted string of data attributes for HTML
Declaration
string $format,
string[] $params
) : self
{
}
Description
Set a format for the text node with parameters for dynamic content.
This method allows you to set a dynamic format for the text of the option. The format string can contain placeholders that will be replaced with the provided parameters.
Parameters
The format string
The parameters for the format
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Retrieve the values of the parameters used in the format.
This method returns an array of parameter values by evaluating each one
through the getValue() method, which may fetch data from the associated MagicObject.
Return
Array of parameter values
Declaration
string $param
) : string|null
{
}
Description
Get the value associated with a given parameter.
This method retrieves the value of a parameter, which could be a property
of the associated MagicObject (if it exists) or simply the parameter name.
Parameters
The parameter name
Return
The value associated with the parameter, or null if not found
Declaration
string $pad = ' '
) : self
{
}
Description
Set padding for the option, typically for nested structures.
This method allows you to specify padding to be applied to the option, typically useful for nested option elements.
Parameters
The padding string (default is a tab character)
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the HTML representation of the option as a string.
This method generates the HTML markup for the option element. It includes the value, display text, selection state, and any additional attributes.
Return
The HTML option element
Declaration
{
}
Description
Alias for the __toString() method.
This method is an alias for __toString() to provide a more intuitive
method name for rendering the option as a string.
Return
The HTML option element
Declaration
{
}
Description
Get the text node for the option.
This method retrieves the text content associated with the option.
Return
The text node
Declaration
string $label
) : self
{
}
Description
Set the text node for the option.
This method allows setting a new text value for the option.
Parameters
The text node to set
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the associated data for the option.
This method retrieves the associated MagicObject that holds additional data
for dynamic value retrieval.
Return
The associated data object, or null if not set
Declaration
{
}
Description
Get additional attributes for the option.
This method returns the additional attributes that are associated with the option. These attributes could be HTML attributes or any custom metadata assigned to the option.
Return
An associative array of attributes, or null if no attributes are set.
Declaration
array|null $attributes
) : self
{
}
Description
Set additional attributes for the option.
This method allows you to assign additional attributes to the option. These can be any valid HTML attributes or custom data attributes you wish to associate with the option.
Parameters
An associative array of attributes to set, or null to clear attributes.
Return
The current instance of the class, allowing for method chaining.
MagicApp\AppLanguage
Declaration
Description
Class AppLanguage
Extends PicoLanguage to manage application-specific language data. Loads language strings from an INI file based on the current language setting.
Properties
Declaration
Description
Application configuration.
Declaration
Description
Current language being used.
Declaration
Description
Callback function for handling missing properties.
Methods
Declaration
SecretObject|null $appConfig = null,
string|null $currentLanguage = null,
callable|null $callback = null
)
{
}
Description
Constructor for AppLanguage.
Parameters
The application configuration object.
The current language to load.
A callback function for missing properties.
Declaration
{
}
Description
Load language data from the INI file.
Return
The parsed language data.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a specified property.
If the property does not exist, the callback (if set) is called.
Parameters
The name of the property to retrieve.
Return
The property value or null if not found.
Declaration
stdClass|array $data
) : self
{
}
Description
Load data into the object.
Parameters
Data to be loaded into the object.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
Name of the property to set.
Value to assign to the property.
Return
Returns the current instance for method chaining.
Declaration
string $name,
mixed $value
) : void
{
}
Description
Magic method to set property values.
Example:
<?php
$instance->foo = 'bar';
Parameters
Name of the property to set.
Value to assign to the property.
Return
Declaration
string $name
) : mixed
{
}
Description
Magic method to get property values.
Example:
<?php
echo $instance->foo;
Parameters
Name of the property to get.
Return
The value stored in the property.
Declaration
string $name
) : bool
{
}
Description
Check if a property is set.
Parameters
Name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $name
) : void
{
}
Description
Unset a property value.
Parameters
Name of the property to unset.
Return
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when an undefined method is invoked.
This method provides dynamic handling for method calls that are not explicitly defined in the class. It specifically supports two types of method calls:
-
Getter Methods:
- When a method name starts with "get", it retrieves the corresponding property value.
- For example, calling
$obj->getAge()will invoke this method and call$this->get('age').
-
Equality Check Methods:
- When a method name starts with "equals", it checks if the provided parameter is equal to the corresponding property value.
- For example, calling
$obj->equalsAge($someValue)will check if$someValueis equal to the value of theageproperty.
If the method does not start with "get" or "equals", this method will return null.
Parameters
Name of the method being called. It should start with "get" or "equals".
Parameters passed to the method; for equality checks, it typically contains the value to compare.
Return
The return value of the getter method or the result of the equality check (true or false), or null if the method is not recognized.
MagicApp\AppMenuGroupItem
Declaration
Description
Class AppMenuGroupItem
Represents a group of menu items, including a label, a CSS class, and the menu items themselves. This class is used to define a collection of related menu items, with a label and a CSS class for styling purposes.
Properties
Declaration
Description
Label for the menu group.
Declaration
Description
CSS class name associated with the menu group.
Declaration
Description
Array of menu items in this group.
Methods
Declaration
{
}
Description
Get the label of the menu group.
This method returns the label associated with the menu group. The label is used to identify the menu group in the user interface.
Return
The label of the menu group.
Declaration
string $label
) : self
{
}
Description
Set the label for the menu group.
This method sets the label that will be associated with the menu group. The label is typically displayed in the user interface to identify the group of menu items.
Parameters
The label for the menu group.
Return
The current instance of the class, allowing for method chaining.
Declaration
{
}
Description
Get the CSS class name of the menu group.
This method returns the CSS class name associated with the menu group. The CSS class is used to style the group in the user interface.
Return
The CSS class name of the menu group.
Declaration
string $class
) : self
{
}
Description
Set the CSS class name for the menu group.
This method sets the CSS class name that will be used to style the menu group in the user interface.
Parameters
The CSS class name.
Return
The current instance of the class, allowing for method chaining.
Declaration
{
}
Description
Get the menu items in this group.
This method returns an array of menu items that belong to this group. The menu items represent the individual actions or links available within the menu group.
Return
Array of menu items in this group.
Declaration
AppMenuItem[] $menuItems
) : self
{
}
Description
Set the menu items for this group.
This method sets an array of menu items for the menu group. Each menu item corresponds to a specific action or link within the group.
Parameters
Array of menu items to be associated with the group.
Return
The current instance of the class, allowing for method chaining.
MagicApp\AppMenuItem
Declaration
MagicApp\AppModule
Declaration
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\AppUser
Declaration
Description
Class AppUser
Represents a user in the application, encapsulating user properties and behaviors. This class provides access to user data through dynamic getter and setter methods.
Properties
Declaration
Description
User ID
Declaration
Description
User level ID
Declaration
Description
Language ID
Declaration
Description
User data object encapsulated in a MagicObject.
Methods
Declaration
MagicObject $user
)
{
}
Description
Constructor
Initializes the AppUser object with the provided user data object.
Parameters
The user data object to initialize the user.
Declaration
string $method,
array $args
) : mixed
{
}
Description
Magic method to handle dynamic getter and setter methods.
This method intercepts calls to getter and setter methods that follow the get and set conventions.
It delegates these calls to the underlying MagicObject to retrieve or set user properties.
Parameters
The name of the method being called (either a getter or setter).
The arguments passed to the method (if any).
Return
The value returned by the MagicObject getter/setter method.
Throws
If the method being called is neither a getter nor setter, or if it does not exist in the MagicObject.
Declaration
{
}
Description
String representation of the AppUser object.
This method converts the AppUser object to a string by calling the __toString() method of the encapsulated MagicObject.
Typically used for debugging and logging purposes.
Return
The string representation of the user data.
MagicApp\AppUserPermission
Declaration
Description
Class AppUserPermission
Manages user permissions for various actions within the application. This class provides functionality to check and load user permissions based on roles and modules.
Properties
Declaration
Description
Application configuration
Declaration
Description
Entity representing user roles.
Declaration
Description
Current module context.
Declaration
Description
Allowed show list
Declaration
Description
Allowed show detail
Declaration
Description
Allowed create
Declaration
Description
Allowed update
Declaration
Description
Allowed delete
Declaration
Description
Allowed approve/reject
Declaration
Description
Allowed short order
Declaration
Description
Allowed export
Declaration
Description
Allowed batch action
Declaration
Description
Indicates if permissions have been initialized.
Declaration
Description
User level
Declaration
Description
Current user
Declaration
Description
User action
Methods
Declaration
SecretObject $appConfig,
PicoDatabase $database,
MagicObject $appUserRole,
PicoModule $currentModule,
AppUser $currentUser
)
{
}
Description
Constructor
Initializes the AppUserPermission object with application configuration, database, user role, current module, and current user.
Parameters
The application configuration object.
The database connection object.
The user role entity.
The current module being accessed.
The current user object.
Declaration
{
}
Description
Load user permissions.
This method loads the permissions for the current user based on their role and the module being accessed. If the role bypasses permissions, all permissions are granted.
Return
Declaration
PicoRequestBase $inputGet,
PicoRequestBase $inputPost
) : boolean
{
}
Description
Check user permission for a given action.
This method checks if the user has permission to perform a specific action, based on input from GET or POST requests.
Parameters
The GET request data.
The POST request data.
Return
True if the user is allowed to perform the action, false otherwise.
Declaration
PicoRequestBase $inputGet,
PicoRequestBase $inputPost,
callable $callbackForbidden
) : void
{
}
Description
Check user permission and trigger a callback if forbidden.
This method checks if the user has permission to perform an action. If not, it triggers the provided callback function to handle the forbidden access.
Parameters
The GET request data.
The POST request data.
The callback function to call when access is forbidden.
Return
Declaration
string $userAction
) : boolean
{
}
Description
Check if user is allowed to perform the given action.
This method checks if the user has permission to perform a specific action based on their roles and permissions.
Parameters
The action the user wants to perform.
Return
True if the user is allowed to perform the action, false otherwise.
Declaration
{
}
Description
Check if user has permission to edit, activate, deactivate, and delete.
Return
True if the user has permission for batch actions, false otherwise.
Declaration
{
}
Description
Check if user has permission to approve.
Return
True if the user has permission to approve, false otherwise.
Declaration
{
}
Description
Get allowed show list permission.
Return
True if the user is allowed to see the list, false otherwise.
Declaration
{
}
Description
Get allowed show detail permission.
Return
True if the user is allowed to see the detail, false otherwise.
Declaration
{
}
Description
Get allowed create permission.
Return
True if the user is allowed to create, false otherwise.
Declaration
{
}
Description
Get allowed update permission.
Return
True if the user is allowed to update, false otherwise.
Declaration
{
}
Description
Get allowed delete permission.
Return
True if the user is allowed to delete, false otherwise.
Declaration
{
}
Description
Get allowed short order permission.
Return
True if the user is allowed to perform sorting, false otherwise.
Declaration
{
}
Description
Get allowed export permission.
Return
True if the user is allowed to perform sorting, false otherwise.
Declaration
{
}
Description
Get user level.
Return
The user level ID.
Declaration
{
}
Description
Get current user.
Return
The current user object.
Declaration
{
}
Description
Get user action.
Return
The action the user wants to perform.
Declaration
{
}
Description
Set allowed sort order to false.
Return
The current instance of the class.
MagicApp\CurrentAction
Declaration
Description
Class CurrentAction
Captures the current user action details, including user information and IP address.
This class is responsible for capturing and providing the details of the current user's action, including the user's identity and IP address. It handles retrieving the user's IP address, accounting for the use of proxy services like Cloudflare, and formatting the current timestamp.
Properties
Declaration
Description
Current user set by constructor.
Declaration
Description
Current IP address.
Methods
Declaration
MagicObject|SecretObject $cfg,
string $user
)
{
}
Description
Constructor
Initializes the CurrentAction object with the user's information and their IP address.
The constructor expects a configuration object for retrieving proxy settings and a string
representing the current user.
Parameters
Configuration object for getting IP settings.
Current user.
Declaration
MagicObject|SecretObject|null $cfg = null
) : string
{
}
Description
Get remote address.
Retrieves the user's remote IP address. If a proxy service like Cloudflare is used,
it fetches the client's IP address from the Cloudflare header. Otherwise, it returns the
address from the REMOTE_ADDR server variable.
Parameters
Configuration object for proxy settings.
Return
The remote address of the user.
Declaration
{
}
Description
Get the current timestamp.
Returns the current time in the format Y-m-d H:i:s for logging or tracking user actions.
Return
Formatted current time.
Declaration
{
}
Description
Get the current user.
Returns the current user, which was set during object construction.
Return
The current user.
Declaration
{
}
Description
Get the current IP address.
Returns the IP address of the user, which was retrieved during object construction.
Return
The current IP address.
MagicApp\EntityApvInfo
Declaration
Description
Class EntityApvInfo
Represents the approval information entity.
This class encapsulates the approval status information of an entity.
It extends from SecretObject to inherit functionality related to security
or handling sensitive data, depending on the implementation of the parent class.
Constants
Properties
Declaration
Description
Approval status
This property holds the approval status of the entity. It can represent various states like "pending", "approved", "rejected", etc.
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\EntityInfo
Declaration
Description
Class EntityInfo
Represents detailed information about an entity, including its attributes such as name, sorting order, status keys (active, draft), and metadata related to creation, editing, and approval processes.
This class extends SecretObject, implying that it handles sensitive
or controlled data, which may include actions and IP addresses
associated with entity creation and editing.
Constants
Properties
Declaration
Description
The name of the entity.
This property stores the name of the entity, which can be used for display purposes or for identification within the system.
Declaration
Description
The sort order for the entity.
This property defines the order in which the entity should be sorted in lists or views within the application.
Declaration
Description
Indicates whether the entity is active.
This property stores a key or value representing whether the entity is currently active. It may be used to filter active entities in queries or lists.
Declaration
Description
Indicates whether the entity is in draft state.
This property stores a key or value indicating whether the entity is currently in draft status, which might affect whether it is shown publicly or is editable.
Declaration
Description
Indicates if the entity was created by an admin.
This property stores a key or value that marks whether the entity was created by an admin, which may influence the permissions or actions available for this entity.
Declaration
Description
Indicates if the entity was edited by an admin.
This property stores a key or value that marks whether the entity was edited by an admin, providing insight into the entity's history and changes made by admin users.
Declaration
Description
The ID of the admin who requested the edit for the entity.
This property stores the ID of the admin user who made a request for the entity to be edited. This can be used to track which admin initiated the request for an edit, providing insight into workflows or permissions.
Declaration
Description
The IP address from which the entity was created.
This property stores the IP address used during the creation of the entity. It could be used for auditing, logging, or security purposes.
Declaration
Description
The IP address from which the entity was last edited.
This property stores the IP address used when editing the entity.
Similar to ipCreate, it provides tracking of user actions on the entity.
Declaration
Description
The IP address from which an edit request was made.
This property tracks the IP address from which a request was made to edit the entity, which could be useful for auditing or monitoring purposes.
Declaration
Description
The timestamp of when the entity was created.
This property stores the exact time the entity was created in the system. It is generally used for logging, tracking, or sorting entities by their creation time.
Declaration
Description
The timestamp of when the entity was last edited.
This property records the timestamp when the entity was last modified. It is useful for tracking changes and determining the recency of updates.
Declaration
Description
The timestamp of when an edit request was made.
This property stores the timestamp when an admin requested an edit to the entity, allowing for tracking of workflows and approval timelines.
Declaration
Description
The key or value representing a pending action.
This property stores a key or value that indicates whether there is something waiting for the entity, such as approval or processing.
Declaration
Description
The approval ID associated with the entity.
This property stores the ID of the approval process associated with the entity, helping to track the state of the entity within an approval workflow.
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Field
Declaration
Description
Class Field
Represents a field with dynamic retrieval of values.
This class uses the magic method __get to return a string representation of a dynamic value.
It provides a static factory method of() to create an instance of the class.
Example usage:
$field = Field::of();
echo $field->name; // Outputs "name"
Methods
Declaration
{
}
Description
Get an instance of Field.
This static method returns a new instance of the Field class.
Return
A new instance of the Field class.
Declaration
string $value
) : string
{
}
Description
Get a value dynamically using property access.
This magic method is triggered when accessing an undefined or dynamic property. It returns the name of the requested property as a string.
Parameters
The name of the property being accessed.
Return
The name of the property.
MagicApp\PicoApproval
Declaration
Constants
Properties
Declaration
Description
Master entity
Declaration
Description
Entity information
Declaration
Description
Entity approval information
Declaration
Description
Callback for validation
Declaration
Description
Callback after approval
Declaration
Description
Callback after rejection
Declaration
Description
Current user performing the action
Declaration
Description
Current time of the action
Declaration
Description
Current IP address of the user
Methods
Declaration
MagicObject $entity,
EntityInfo $entityInfo,
EntityApvInfo $entityApvInfo,
callable|null $callbackValidation = null
)
{
}
Description
Constructor
Initializes the approval handler with the provided entity, entity information, approval status information, and an optional validation callback.
This constructor is used to set up the necessary components to manage the approval and rejection process for the given entity. The validation callback, if provided, will be used during the approval process to perform custom validation checks before proceeding with the approval or rejection of the entity.
Parameters
The master entity being approved or rejected.
Information about the entity, including metadata like
Information about the entity's approval status
Optional validation callback to perform
Declaration
string[] $columnToBeCopied,
MagicObject|null $entityApv,
MagicObject|null $entityTrash,
string $currentUser,
string $currentTime,
string $currentIp,
SetterGetter|null $approvalCallback = null
) : self
{
}
Description
Approve the entity based on its current status and the provided parameters.
This method handles the approval process for the entity, taking actions based on its current status and the type of approval required (e.g., create, update, delete, etc.). It also allows for optional callback actions before and after the approval process. The method updates the entity's fields, such as approval status, draft state, and approval ID, according to the approval type.
The method can approve various actions:
- CREATE: Sets the entity to a finalized state by removing the draft status and resetting approval ID.
- ACTIVATE: Approves the activation of the entity.
- DEACTIVATE: Approves the deactivation of the entity.
- UPDATE: Approves the update of the entity, copying specified columns from the approval entity.
-
DELETE: Approves the deletion of the entity, optionally moving the data to a trash entity.
Additionally, if the
approvalCallbackis provided, it can trigger actions before or after the approval process.
Parameters
Columns to copy from the approval entity.
Approval entity, used for approval actions like updating or copying.
Trash entity for storing deleted data.
The user performing the approval.
The current time of the action.
The current IP address of the user performing the action.
Optional callback for approval, which can trigger actions before and after the approval process.
Return
The current instance, allowing method chaining The current instance of the class, allowing for method chaining.
Declaration
{
}
Description
Approve activation of the entity.
This method approves the activation of the entity by updating its status to active. It clears any pending actions and preserves the relevant information regarding the last edit request, including admin details, timestamp, and IP address. The entityΓÇÖs status is updated to reflect that it is now active and ready for further actions.
- The entity's
activefield is set totrue, indicating that the entity is now active. - The
waitingForfield is set toNOTHING, meaning no further actions are pending. - The fields such as
adminAskEdit,timeAskEdit, andipAskEditretain the values from the previous edit request, ensuring continuity of the last action performed.
Return
Declaration
{
}
Description
Approve deactivation of the entity.
This method approves the deactivation of the entity by updating its status to inactive. It clears any pending edits and resets the relevant fields such as admin request, timestamp, and IP address of the last request. The entityΓÇÖs status is updated to indicate that it is no longer active and that no further actions are pending.
- The entity's
activefield is set tofalse, indicating deactivation. - The
waitingForfield is set toNOTHING, meaning no further actions are required. - Fields such as
adminAskEdit,timeAskEdit, andipAskEditare preserved from the previous request, ensuring that these values are not lost during the deactivation process.
Return
Declaration
MagicObject $entityTrash,
string $currentUser,
string $currentTime,
string $currentIp,
SetterGetter|null $approvalCallback = null
) : self
{
}
Description
Approve deletion of the entity.
This method handles the approval and execution of the entity's deletion process. Before performing the deletion, the method can execute custom logic through optional callbacks. The method supports copying the entity's data to a trash or backup table before deletion.
- If an
entityTrashis provided, the entity's data will be copied to the trash table before deletion. - The method allows for callback functions to be executed before and after the deletion process, allowing custom logic to be integrated.
Parameters
Entity to store deleted data
The user performing the deletion
The current time of the action
The current IP address of the user
Optional callback for deletion
Return
The current instance, allowing method chaining
Declaration
MagicObject $entityApv,
string|null $currentUser = null,
string|null $currentTime = null,
string|null $currentIp = null,
SetterGetter|null $approvalCallback = null
) : self
{
}
Description
Reject the entity approval.
This method handles the rejection of an entity's approval process. It updates the approval status to "rejected" and performs corresponding actions based on the current status of the entity. The method also supports optional callback functions to be executed before and after the rejection, allowing for custom logic.
- If the entity is waiting for creation approval, it will be deleted upon rejection.
- If the entity is waiting for update, activation, deactivation, or deletion approval, it will reset the waiting status and approval ID after rejection.
Parameters
The approval entity to reject
The user performing the rejection (optional)
The current time of the action (optional)
The current IP address of the user (optional)
Optional callback for rejection logic
Return
The current instance, allowing method chaining
Declaration
MagicObject $entityApv,
string $currentUser
) : boolean
{
}
Description
Validate the approval process.
This method checks if the approval process is valid by using a callback function,
if provided. The callback function allows for custom validation logic to be applied
to the entity, the approval entity, and the current user performing the action.
If no callback is provided, it simply returns true, indicating that the approval
process is valid by default.
Parameters
The approval entity to validate
The user performing the action
Return
true if validation passes, false otherwise
Declaration
MagicObject $entityApv,
string[] $columnToBeCopied
) : self
{
}
Description
Approve the update of the entity.
This method handles the approval process for updating an entity, copying specified columns from an approval entity, and updating the original entity with those values. It also resets the approval status and clears the approval ID once the update is complete.
Parameters
Approval entity
Columns to copy from the approval entity
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the current user.
This method returns the username or identifier of the current user.
Return
The current user's identifier or name.
Declaration
{
}
Description
Get the current time.
This method returns the current timestamp or time when the action was performed.
Return
The current time in a formatted string (e.g., 'Y-m-d H:i:s').
Declaration
{
}
Description
Get the current IP address.
This method returns the IP address of the user making the request or action.
Return
The current IP address of the user.
Declaration
{
}
Description
Get callback after approval
Return
Declaration
{
}
Description
Get callback after rejection
Return
MagicApp\PicoModule
Declaration
Constants
Properties
Declaration
Description
App configuration object.
Declaration
Description
Target directory for module operations.
Declaration
Description
Name of the module.
Declaration
Description
Title of the module.
Declaration
Description
Path of the PHP script that is currently executing.
Declaration
Description
User role object for the current session.
Declaration
Description
List of allowed modules for the current user role.
Declaration
Description
Database connection object.
Declaration
Description
Application module object.
Methods
Declaration
SecretObject $appConfig,
PicoDatabase $database,
AppModule|mixed $appModule = null,
string|null $targetDirectory = null,
string|null $moduleName = null,
string|null $moduleTitle = null
)
{
}
Description
Constructor for the PicoModule class.
Parameters
Configuration for the application.
Database connection.
Application module object.
Target directory for the module.
Name of the module.
Title of the module.
Declaration
MagicObject[] $appUserRoles
) : MagicObject
{
}
Description
Get the user role for the current session.
Parameters
List of user roles.
Return
The user role object.
Declaration
MagicObject[] $appUserRoles
) : array
{
}
Description
Get the list of allowed modules for the current user role.
Parameters
List of user roles.
Return
Array of allowed module IDs.
Declaration
MagicObject[] $appUserRoles
) : self
{
}
Description
Parse user roles to determine allowed modules and user role.
This method processes the list of user roles and identifies which modules the user is allowed to access based on their roles. It also determines the user's specific role by matching the module name.
The method populates the allowedModules array with the IDs of the modules the user
has access to, and sets the userRole property to the role that corresponds to the
current module.
Parameters
List of user roles to be processed.
Return
Returns the current instance for method chaining.
Declaration
MagicObject $role
) : boolean
{
}
Description
Check if the given role has access to the application.
Parameters
The role to check.
Return
True if access is allowed, false otherwise.
Declaration
{
}
Description
Get the name of the current script.
Return
The name of the current PHP script.
Declaration
{
}
Description
Redirect the user to the current script.
Return
Declaration
{
}
Description
Redirect the user to the current script with a specific parameter to show require approval only.
Return
Declaration
string|null $userAction = null,
string|null $parameterName = null,
string|null $parameterValue = null
) : void
{
}
Description
Redirect to a specified URL.
Parameters
Current action to perform.
Name of the parameter to append.
Value of the parameter to append.
Return
Declaration
string|null $userAction = null,
string|null $parameterName = null,
string|null $parameterValue = null,
string[]|null $additionalParams = null
) : string
{
}
Description
Generate a redirect URL based on the current context.
Parameters
Action to perform.
Parameter name to include in the URL.
Parameter value to include in the URL.
Additional parameters to include in the URL.
Return
The generated redirect URL.
Declaration
{
}
Description
Get the name of the module.
Return
The module name.
Declaration
{
}
Description
Get the title of the module.
Return
The module title.
Declaration
{
}
Description
Get the database connection.
Return
The database connection object.
Declaration
{
}
Description
Get the application module.
Return
The application module object.
Declaration
{
}
Description
Get the target directory for the module.
Return
The target directory.
MagicApp\UserAction
Declaration
Description
Class UserAction
This class handles various actions a user can perform within the system. It provides methods to determine if an action requires approval, handles the approval waiting message, and checks if a next action is specified.
Constants
Methods
Declaration
mixed $waitingFor
) : boolean
{
}
Description
Determine if an action requires approval.
Parameters
The status indicating what is waiting for approval.
Return
True if approval is required, false otherwise.
Declaration
mixed $inputGet
) : boolean
{
}
Description
Determine if a next action is specified in the input.
Parameters
The input data containing the next action.
Return
True if there is a next action, false otherwise.
Declaration
object $appLanguage,
mixed $waitingFor
) : string
{
}
Description
Get the approval waiting message based on the specified action.
Parameters
The language object for fetching messages.
The action waiting for approval.
Return
The approval message.
Declaration
object $appLanguage,
mixed $waitingFor
) : string
{
}
Description
Get the short waiting text based on the specified action.
Parameters
The language object for fetching messages.
The action waiting for approval.
Return
The short approval message.
MagicApp\WaitingFor
Declaration
Constants
Methods
Declaration
int $status
) : string
{
}
Description
Get the description of the waiting status.
This method provides a human-readable description of the given waiting status. Each constant in the class represents a specific status, and this method returns the corresponding description based on the value passed.
Parameters
The waiting status constant (e.g., WaitingFor::CREATE).
Return
The description of the waiting status.
MagicApp\AppDto\MocroServices\PicoAllowedAction
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoAllowedAction
Represents an allowed action that can be performed on a field or entity. This class manages the value and label associated with the action, which can be used to define permitted operations or actions within a system.
Properties
Declaration
Description
The actual value representing the allowed action. This can be a string, integer, or other data type depending on the action.
Declaration
Description
The label associated with the allowed action, typically used for display purposes. For example, "Create", "Update", "Delete", etc.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
mixed $value = null,
string|null $label = null
)
{
}
Description
Constructor for initializing the object with a value and an optional label.
This constructor accepts a required value, and an optional label. If the label is not provided, the value is used as the label by default.
Parameters
The value to be assigned to the object. This could be a string, integer, or other type.
The label associated with the value. If not provided, the value is used as the label.
Declaration
mixed $value
) : self
{
}
Description
Set the value assigned to the object.
Parameters
The value assigned to the object.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the label associated with the value.
Return
Declaration
string $label
) : self
{
}
Description
Set the label associated with the value.
Parameters
The label associated with the value.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoDataConstructor
Declaration
Properties
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoDataHeader
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoDataHeader
Represents the header information for a data table or list. This class manages the field name, its label for display purposes, and the sorting order (ASC, DESC, or null). It is used for defining the structure and sorting behavior of data headers in a user interface.
Properties
Declaration
Description
The field name, which is typically used as the key for sorting or identifying the field. This value can be a string or other data type depending on the field's nature.
Declaration
Description
The label for the field, typically used for display to the user. This is a human-readable string representing the field name.
Declaration
Description
The sorting order for the field, which can be:
ASCfor ascending order,DESCfor descending order,nullif no sorting order is defined.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
mixed $value,
string $label,
string|null $sort = null
)
{
}
Description
PicoDataHeader constructor.
Initializes the data header with a field name, a label, and an optional sorting order.
Parameters
The field name, used as the key for sorting or identifying the field.
The label for the field, typically used for display to the user.
The sorting order for the field (optional).
Declaration
{
}
Description
Get the sort order.
This method returns the current sort order, which can be a value such as ASC, DESC, or null.
Return
The current sort order.
Declaration
string $sort
) : self
{
}
Description
Set the sort order.
This method sets the sort order, which could be ASC, DESC, or any other string value indicating the sorting preference.
Parameters
The sort order to be set (e.g., 'ASC', 'DESC').
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the field value.
This method retrieves the field value, which can be a string or other data type depending on the field's nature.
Return
The value of the field.
Declaration
mixed $value
) : self
{
}
Description
Set the field value.
This method sets the value of the field, which can be a string or other data type.
Parameters
The value to be set for the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoEntityData
Declaration
Package
MagicApp\AppDto\MicroServicesDescription
Class PicoEntityData
Represents the data associated with an entity, including its primary key and primary key values.
Properties
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoEntityInfo
Declaration
Description
Class PicoEntityInfo
This class contains the mapping for column information related to an entity. It holds the properties for various column values such as active status, draft status, waiting status, and approval ID.
Properties
Declaration
Description
Column name to store status active or inactive
Declaration
Description
Column name to store draft status
Declaration
Description
Column name to store waitingFor value
Declaration
Description
Column name to store approvalId value
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
string $active = null,
string $draft = null,
string $waitingFor = null,
string $approvalId = null
)
{
}
Description
PicoEntityInfo constructor. Initializes the properties with the given values.
Parameters
The status of the entity, either active or inactive.
The draft status of the entity.
The waitingFor value.
The approval ID for the entity.
Declaration
{
}
Description
Get the active status of the entity.
Return
Declaration
string $active
) : self
{
}
Description
Set the active status of the entity. Returns the current instance for method chaining.
Parameters
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the draft status of the entity.
Return
Declaration
string $draft
) : self
{
}
Description
Set the draft status of the entity. Returns the current instance for method chaining.
Parameters
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the waitingFor value of the entity.
Return
Declaration
string $waitingFor
) : self
{
}
Description
Set the waitingFor value of the entity. Returns the current instance for method chaining.
Parameters
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the approval ID of the entity.
Return
Declaration
string $approvalId
) : self
{
}
Description
Set the approval ID of the entity. Returns the current instance for method chaining.
Parameters
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoFieldWaitingFor
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoFieldWaitingFor
Represents the status of a field waiting for an action to be performed.
This class is used to manage the actions that are pending on a field.
Examples of actions include create, update, activate, deactivate,
delete, and sort-order, each associated with a specific integer value.
Action codes:
create= 1update= 2activate= 3deactivate= 4delete= 5sort-order= 6
Properties
Declaration
Description
The numeric value representing the action waiting for the field. This value corresponds to a specific action (e.g., 1 for create, 2 for update).
Declaration
Description
The human-readable code for the action. For example, "create", "update", "activate", etc.
Declaration
Description
The label describing the action for user-friendly display. This will be localized according to the language used. For example, "Create", "Update", "Activate", etc.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
integer $value,
string $code,
string $label
)
{
}
Description
Constructor to initialize the properties of the class.
Parameters
The numeric value representing the action code.
The human-readable code for the action.
The user-friendly label describing the action.
Declaration
{
}
Description
Get the numeric value representing the action.
Return
Declaration
integer $value
) : self
{
}
Description
Set the numeric value representing the action.
Parameters
The action code.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the human-readable code for the action.
Return
Declaration
string $code
) : self
{
}
Description
Set the human-readable code for the action.
Parameters
The action code.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the label describing the action for user-friendly display.
Return
Declaration
string $label
) : self
{
}
Description
Set the label describing the action for user-friendly display.
Parameters
The action label.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoFilterData
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoFilterData
Represents filter data associated with a specific entity within the Pico service.
This class extends PicoEntityData and contains logic for managing a filter object
that can be set or retrieved. The filter is represented by an instance of InputFieldFilter.
The class provides getter and setter methods for the filter variable, allowing for easy access and manipulation of the associated filter data.
Methods:
- getFilter(): Retrieves the current filter object.
- setFilter(InputFieldFilter $filter): Sets the filter object.
Properties
Declaration
Description
The filter object associated with this Pico entity.
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Get the filter object.
This method retrieves the current filter associated with this entity.
Return
The current filter object
Declaration
InputFieldFilter $filter
) : self
{
}
Description
Set the filter object.
This method allows for setting the filter object for this entity.
Parameters
The filter object to be set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoFilterDetail
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoFilterDetail
Represents a detailed filter within the Pico service. This class extends
PicoObjectToString and contains a PicoInputField instance that holds
the specific input field data for this filter detail.
The class encapsulates a PicoInputField, which can be accessed or
manipulated to define detailed filtering criteria for a Pico object.
This class provides getter and setter methods for managing the input field
associated with the filter.
Methods:
- getField(): Retrieves the input field associated with this filter detail.
- setField(PicoInputField $field): Sets the input field for the filter detail.
Properties
Declaration
Description
The input field associated with this filter detail.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Get the input field associated with this filter detail.
This method retrieves the PicoInputField instance that is associated
with this filter detail.
Return
The input field associated with this filter detail.
Declaration
PicoInputField $field
) : self
{
}
Description
Set the input field associated with this filter detail.
This method assigns a PicoInputField instance to this filter detail,
allowing the definition or modification of the filter criteria.
Parameters
The input field to associate with the filter detail.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputField
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputField
This class represents an input field, which includes a value and a label. It is used to model the structure of form fields or input elements, where each field has a value (which can be of any type) and a label (which is a string for display to the user).
Properties
Declaration
Description
The value associated with the input field.
This can be of any type, depending on the context of the field (e.g., string, integer, etc.).
Declaration
Description
The label associated with the input field.
This is a string used for displaying a label to the user for the input field.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Get this can be of any type, depending on the context of the field (e.g., string, integer, etc.).
Return
Declaration
mixed $value
) : self
{
}
Description
Set this can be of any type, depending on the context of the field (e.g., string, integer, etc.).
Parameters
This can be of any type, depending on the context of the field (e.g., string, integer, etc.).
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get this is a string used for displaying a label to the user for the input field.
Return
Declaration
string $label
) : self
{
}
Description
Set this is a string used for displaying a label to the user for the input field.
Parameters
This is a string used for displaying a label to the user for the input field.
Return
Returns the current instance for method chaining.
Declaration
AppLabelValueData[] $options
) : PicoInputField|null
{
}
Description
Retrieves the selected value from a list of options.
This method iterates over an array of AppLabelValueData objects and returns a new instance of PicoInputField with the value and label of the selected option.
Parameters
An array of AppLabelValueData objects.
Return
Returns a new PicoInputField instance for the selected option, or null if none is selected.
Declaration
mixed $value = null,
string|null $label = null
)
{
}
Description
Constructor for initializing the object with a value and an optional label.
This constructor accepts a required value, and an optional label. If the label is not provided, the value is used as the label by default.
Parameters
The value to be assigned to the object. This could be a string, integer, or other type.
The label associated with the value. If not provided, the value is used as the label.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputFieldFilter
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputFieldFilter
Represents an input field used for filtering data in a form or list.
This class extends PicoInputFieldInsert and adds functionality for storing
the current value of the input, which is typically sent by the user
during a previous action, such as a search or filter operation.
Properties
Declaration
Description
The current value of the input field, typically representing the user's input from a previous action, such as a search or filter operation.
Declaration
Description
The name or identifier for the input field.
Declaration
Description
The label to be displayed alongside the input field, typically describing the purpose of the field.
Declaration
Description
The type of the input field (e.g., text, number, email, etc.), determining how the input is handled.
Declaration
Description
The data type of the input field (e.g., string, integer, boolean, etc.), defining the expected type of the input.
Declaration
Description
The source for options when the input type requires them, such as a list of options for a select dropdown. This could be a URL that provides the options dynamically.
Declaration
Description
URL that provides options for the input field (e.g., data source for dynamic select options).
Declaration
Description
An array of InputFieldOption objects representing the available options for the input field. Used primarily for fields like select/dropdown, where users can choose from a list of predefined options.
Declaration
Description
A regular expression pattern used to validate the input (optional). It can be used for enforcing format restrictions, such as for email or phone number fields.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $inputType,
string $dataType,
string|null $optionSource = null,
InputFieldOption[]|null $map = null,
string|null $pattern = null,
PicoInputFieldValue $currentValue = null
)
{
}
Description
Constructor for PicoInputFieldFilter. Initializes the input field properties with provided values.
Parameters
Input field
The type of the input field.
The data type of the input field.
Optional source for options (e.g., for a select dropdown).
Optional array of available options for the input field.
Optional regular expression pattern for validation.
Declaration
{
}
Description
Get the current value of the input field.
Return
The current value of the input field.
Declaration
PicoInputFieldValue $currentValue
) : self
{
}
Description
Set the current value of the input field.
Parameters
The current value to set for the input field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputFieldInsert
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputFieldInsert
Represents the configuration of an input field to be inserted into a form. This class allows the definition of various properties for the input field, such as its name, label, type, data type, and additional attributes like validation patterns, option sources, and input options mapping.
It supports pattern matching for input validation, specifies the data types (e.g., string, integer, boolean), handles option sources for select/dropdown fields, and allows the mapping of input options.
Properties
Declaration
Description
The name or identifier for the input field.
Declaration
Description
The label to be displayed alongside the input field, typically describing the purpose of the field.
Declaration
Description
The type of the input field (e.g., text, number, email, etc.), determining how the input is handled.
Declaration
Description
The data type of the input field (e.g., string, integer, boolean, etc.), defining the expected type of the input.
Declaration
Description
The source for options when the input type requires them, such as a list of options for a select dropdown. This could be a URL that provides the options dynamically.
Declaration
Description
URL that provides options for the input field (e.g., data source for dynamic select options).
Declaration
Description
An array of InputFieldOption objects representing the available options for the input field. Used primarily for fields like select/dropdown, where users can choose from a list of predefined options.
Declaration
Description
A regular expression pattern used to validate the input (optional). It can be used for enforcing format restrictions, such as for email or phone number fields.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $inputType,
string $dataType,
string|null $optionSource = null,
InputFieldOption[]|string|null $map = null,
string|null $pattern = null
)
{
}
Description
Constructor for PicoInputFieldInsert. Initializes the properties of the input field with the provided values.
Parameters
The input field object containing field values and label.
The type of the input field (e.g., text, number, email).
The data type of the input field (e.g., string, integer, boolean).
Optional source for dynamically populated options (e.g., URL).
Optional array of available options for the input field.
Optional regular expression pattern for validating the input.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputFieldOption
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputFieldOption
Represents an individual option element for a form input, typically used in select dropdowns.
This class allows setting the value, label, selection state, and HTML attributes for an option.
It also supports adding non-standard data- attributes to the option element, enabling additional
custom data storage.
Properties
Declaration
Description
The value of the option, typically submitted when the option is selected.
Declaration
Description
The label displayed for the option in the user interface.
Declaration
Description
Indicates whether the option is selected by default.
Declaration
Description
Standard HTML attributes for the
Declaration
Description
Non-standard HTML attributes for the
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Factory method to create an instance of PicoInputFieldOption.
This static method provides an alternative way to instantiate the PicoInputFieldOption class.
Return
A new instance of PicoInputFieldOption.
Declaration
string $value,
string $label,
bool|null $selected = null
)
{
}
Description
PicoInputFieldOption constructor.
Initializes the option with a value, label, and an optional selected state.
Parameters
The value of the option, typically submitted when the option is selected.
The label displayed for the option in the user interface.
Indicates whether the option is selected by default (optional).
Declaration
{
}
Description
Get the value of the option, typically submitted when the option is selected.
Return
The value of the option.
Declaration
string $value
) : self
{
}
Description
Set the value of the option, typically submitted when the option is selected.
Parameters
The value of the option.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the label displayed for the option in the user interface.
Return
The label of the option.
Declaration
string $label
) : self
{
}
Description
Set the label displayed for the option in the user interface.
Parameters
The label to display for the option.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get standard HTML attributes for the
Return
The HTML attributes for the
Declaration
array|null $attributes
) : self
{
}
Description
Set standard HTML attributes for the
Parameters
The HTML attributes for the
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the non-standard HTML data- attributes for additional custom data storage.
Return
The data- attributes for the
Declaration
array|null $data
) : self
{
}
Description
Set the non-standard HTML data- attributes for additional custom data storage.
Parameters
The data- attributes for the
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get indicates whether the option is selected by default.
Return
Declaration
bool|null $selected
) : self
{
}
Description
Set indicates whether the option is selected by default.
Parameters
Indicates whether the option is selected by default.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputFieldUpdate
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputFieldUpdate
Extends the PicoInputFieldInsert class, adding functionality for managing and updating the current value of an input field. This class is useful for cases where input fields need to reflect an existing value, such as in form edit scenarios.
Properties
Declaration
Description
The current value of the input field, typically used when editing or updating a record.
Declaration
Description
The name or identifier for the input field.
Declaration
Description
The label to be displayed alongside the input field, typically describing the purpose of the field.
Declaration
Description
The type of the input field (e.g., text, number, email, etc.), determining how the input is handled.
Declaration
Description
The data type of the input field (e.g., string, integer, boolean, etc.), defining the expected type of the input.
Declaration
Description
The source for options when the input type requires them, such as a list of options for a select dropdown. This could be a URL that provides the options dynamically.
Declaration
Description
URL that provides options for the input field (e.g., data source for dynamic select options).
Declaration
Description
An array of InputFieldOption objects representing the available options for the input field. Used primarily for fields like select/dropdown, where users can choose from a list of predefined options.
Declaration
Description
A regular expression pattern used to validate the input (optional). It can be used for enforcing format restrictions, such as for email or phone number fields.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $inputType,
string $dataType,
string|null $optionSource = null,
InputFieldOption[]|null $map = null,
string|null $pattern = null
)
{
}
Description
Constructor for PicoInputFieldUpdate. Initializes the input field properties with provided values.
Parameters
Input field
The type of the input field.
The data type of the input field.
Optional source for options (e.g., for a select dropdown).
Optional array of available options for the input field.
Optional regular expression pattern for validation.
Declaration
{
}
Description
Get the current value of the input field, typically used when editing or updating a record.
Return
Declaration
InputFieldValue $currentValue
) : self
{
}
Description
Set the current value of the input field, typically used when editing or updating a record.
Parameters
The current value of the input field, typically used when editing or updating a record.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoInputFieldValue
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoInputFieldValue
Represents the value of an input field along with its display label. This class is used to manage and store the actual value of a form field (such as the value saved to a database) and its corresponding label (which is typically used for displaying the value in the user interface).
Properties
Declaration
Description
The actual value saved to the database.
Declaration
Description
The label associated with the actual value, typically used for display purposes.
Declaration
Description
The name or identifier for the input field.
Declaration
Description
The type of the input field (e.g., text, number, email, etc.), determining how the input is handled.
Declaration
Description
The data type of the input field (e.g., string, integer, boolean, etc.), defining the expected type of the input.
Declaration
Description
The source for options when the input type requires them, such as a list of options for a select dropdown. This could be a URL that provides the options dynamically.
Declaration
Description
URL that provides options for the input field (e.g., data source for dynamic select options).
Declaration
Description
An array of InputFieldOption objects representing the available options for the input field. Used primarily for fields like select/dropdown, where users can choose from a list of predefined options.
Declaration
Description
A regular expression pattern used to validate the input (optional). It can be used for enforcing format restrictions, such as for email or phone number fields.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $inputType,
string $dataType,
string|null $optionSource = null,
InputFieldOption[]|string|null $map = null,
string|null $pattern = null
)
{
}
Description
Constructor for PicoInputFieldInsert. Initializes the properties of the input field with the provided values.
Parameters
The input field object containing field values and label.
The type of the input field (e.g., text, number, email).
The data type of the input field (e.g., string, integer, boolean).
Optional source for dynamically populated options (e.g., URL).
Optional array of available options for the input field.
Optional regular expression pattern for validating the input.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoModuleInfo
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoModuleInfo
This class represents information about a module within the application. It stores the module's name, title, path, section, and allowed actions.
- The
namerefers to the unique identifier of the module. - The
titleis a human-readable label for the module. - The
pathrefers to the location or URL of the module. -
The
sectionindicates the specific part or view of the module (e.g., "list" for listing data, "detail" for displaying detailed information).This class allows setting and getting these properties, as well as managing allowed actions that can be performed on the module.
Properties
Declaration
Description
The name of the module.
This property stores the unique name identifier of the module, used for referencing or accessing the module within the system.
Declaration
Description
The title of the module.
This property holds the title or label of the module, typically used for display purposes in the user interface.
Declaration
Description
The path of the module.
This property defines the file path or URL path associated with the module, used for routing or linking to the module's content.
Declaration
Description
The section to which the module belongs.
This property defines the section or category in which the module is organized. The section can represent the type of view the module should display, for example:
- "list" for a list view to display multiple items.
- "detail" for a detail view to display detailed information about a single item.
Declaration
Description
A list of allowed actions that can be performed on the module.
This property stores the allowed actions for the module. These actions could include
operations like updating, activating, or deleting records, and are represented by
AllowedAction objects.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
string $name,
string $title,
string $path,
string $section = null
)
{
}
Description
Constructor for PicoModuleInfo. Initializes the module's name, title, path, and section properties.
Parameters
The name of the module.
The title of the module.
The path of the module.
The section the module belongs to (e.g., "list", "detail").
Declaration
{
}
Description
Get the name of the module.
Return
The name of the module.
Declaration
string $name
) : self
{
}
Description
Set the name of the module.
Parameters
The name of the module.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the title of the module.
Return
The title of the module.
Declaration
string $title
) : self
{
}
Description
Set the title of the module.
Parameters
The title of the module.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the path of the module.
Return
The path of the module.
Declaration
string $path
) : self
{
}
Description
Set the path of the module.
Parameters
The path of the module.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the section the module belongs to.
The section represents the view type or purpose of the module (e.g., "list" or "detail").
Return
The section the module belongs to.
Declaration
string $section
) : self
{
}
Description
Set the section the module belongs to.
The section defines the view type or category for the module. For example, "list" for listing multiple items, or "detail" for displaying details of a single item.
Parameters
The section the module belongs to.
Return
Returns the current instance for method chaining.
Declaration
AllowedAction $allowedAction
) : self
{
}
Description
Add an allowed action to the module.
This method adds an AllowedAction object to the list of actions that can be performed
on the module. Allowed actions might include operations like updating, activating, or
deleting records.
Parameters
The AllowedAction object to be added.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the list of allowed actions for the module.
Return
The list of AllowedAction objects for the module.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoObjectToString
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoObjectToString
This class provides functionality to convert an object into a JSON string representation.
It overrides the __toString() method to return a JSON-encoded string of the object.
The toArray() method is used to convert the object into an associative array,
excluding any properties with a null value and ignoring the __caseFormat property.
If any properties are objects themselves, they are recursively converted into arrays
(by calling their toArray() method) before being included in the final JSON string.
Additionally, this class supports converting property names between camelCase and snake_case.
Properties
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoOutputDataItem
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoOutputDataItem
Represents an item of output data, typically used in the context of displaying or processing data in a list or table. This class stores and manages the associated data for the item, where each key corresponds to a field name, and the value holds the field's data. Additionally, it tracks various flags indicating the current status of the item, such as whether it is active, draft, or awaiting approval or other actions.
Properties
Declaration
Description
Associated data for the item. Each key represents a field name, and the value corresponds to the data for that field.
Declaration
Description
Primary key values for the data item.
Declaration
Description
The current status of the data item, typically used to indicate
whether the item is waiting for a specific action, such as approval,
update, or another process. This status is represented by a PicoFieldWaitingFor object.
Declaration
Description
Flag indicating whether the data item is active or inactive.
If null, the flag is considered inactive, and the front-end application
should not use it for decision-making.
Declaration
Description
Flag indicating whether the data item is in draft status.
If null, the draft flag is not used by the front-end application.
Declaration
Description
The approval ID associated with the data item, if any.
Declaration
Description
Primary key
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
array|null $data,
MagicObject|null $entity = null,
string[]|null $primaryKey = null,
PicoEntityInfo|null $entityInfo = null
)
{
}
Description
Constructor for the PicoOutputDataItem class. Initializes the properties with provided values. If a value is not provided for a property, it will remain uninitialized (null).
Parameters
The associated data for the item. Each key represents a field,
Original data entity.
List of primary keys for the data item.
Object containing flags that indicate whether the item is a draft, final version, or has other status.
Declaration
MagicObject $entity,
string[] $primaryKey
) : self
{
}
Description
Sets the primary key values from the provided entity.
Parameters
The entity from which to extract primary key values.
List of primary keys.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoOutputFieldApproval
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoOutputFieldApproval
Extends the OutputFieldDetail class to include a proposed value for approval or rejection. This class is useful in scenarios where a field's value is being reviewed or moderated, allowing users to propose changes that can later be approved or rejected.
Properties
Declaration
Description
Draft value made by another user, awaiting approval or rejection.
Declaration
Description
The name or identifier for the field.
Declaration
Description
The label to be displayed alongside the field.
Declaration
Description
The data type of the field (e.g., string, integer, date).
Declaration
Description
The current value of the field, typically used when editing or updating a record.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $dataType = 'string',
InputFieldValue|null $currentValue = null,
InputFieldValue|null $proposedValue = null
)
{
}
Description
PicoOutputFieldApproval constructor.
Initializes the properties of the field, label, data type, current value, and proposed value. This constructor ensures that the proposed value (if provided) is assigned to the appropriate property.
Parameters
The input field object containing the field's value and label.
The data type of the field (e.g., string, integer, date).
The current value of the field, typically used for editing or updating.
The proposed value of the field, typically used for approval (optional).
Declaration
{
}
Description
Get the current value of the input field.
Returns the value of the field, which can be used when displaying or editing the field.
Return
The current value of the input field or null if not set.
Declaration
InputFieldValue $currentValue
) : self
{
}
Description
Set the current value of the input field.
Allows updating the current value of the field, which is useful for editing or saving data.
Parameters
The new current value to set for the input field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoOutputFieldDetail
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoOutputFieldDetail
Represents the details of an output field in a form or data display context. This class manages the field's name, label, data type, and its current value, which is useful for displaying the field in a form or outputting it in a user interface. It also handles the value associated with the field when editing or updating a record.
Properties
Declaration
Description
The name or identifier for the field.
Declaration
Description
The label to be displayed alongside the field.
Declaration
Description
The data type of the field (e.g., string, integer, date).
Declaration
Description
The current value of the field, typically used when editing or updating a record.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputField $inputField,
string $dataType = 'string',
InputFieldValue|null $currentValue = null
)
{
}
Description
PicoOutputFieldDetail constructor.
Initializes the properties of the field, label, data type, and current value.
If no current value is provided, it defaults to null.
Parameters
The input field object that contains the field's value and label.
The data type of the field (e.g., string, integer, date).
The current value of the field, used for editing/updating (optional).
Declaration
{
}
Description
Get the current value of the input field.
Returns the value of the field, which can be used when displaying or editing the field.
Return
The current value of the input field or null if not set.
Declaration
InputFieldValue $currentValue
) : self
{
}
Description
Set the current value of the input field.
Allows updating the current value of the field, which is useful for editing or saving data.
Parameters
The new current value to set for the input field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoPrimaryKeyValue
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoPrimaryKeyValue
Represents a primary key and its value for an entity.
Properties
Declaration
Description
Name of the primary key
Declaration
Description
Value of the primary key
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
string $name,
mixed $value
)
{
}
Description
Constructor to initialize the primary key name and value.
Parameters
The primary key name
The primary key value
Declaration
{
}
Description
Gets the name of the primary key.
Return
The primary key name
Declaration
string $name
)
{
}
Description
Sets the name of the primary key.
Parameters
The primary key name
Declaration
{
}
Description
Gets the value of the primary key.
Return
The primary key value
Declaration
mixed $value
)
{
}
Description
Sets the value of the primary key.
Parameters
The primary key value
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoResponseBody
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoResponseBody
This class represents the response body of an API or service response. It encapsulates
information such as the response code, response text, and the data returned by the service.
The toArray() and __toString() methods, inherited from the parent class ObjectToString,
are used to convert this response object into a JSON string or an associative array.
This class is designed to help format the response into a structured and readable format.
Properties
Declaration
Description
The response code from the service or API.
Declaration
Description
The response message or text from the service or API.
Declaration
Description
Module
Declaration
Description
The data returned in the response, which can be of any type.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
string $responseCode,
string $responseText,
mixed $data = null,
string|null $primaryKey = null
)
{
}
Description
Constructor for PicoResponseBody.
Initializes the response code, response text, data, and an optional primary key. This constructor allows setting the values of these properties when creating a new instance of the class.
Parameters
The response code from the service.
The response text or message.
The data returned in the response (optional).
The primary key associated with the response (optional).
Declaration
{
}
Description
Get a new instance of PicoResponseBody.
This static method provides a way to create an instance of PicoResponseBody without setting any values initially.
Return
A new instance of PicoResponseBody with default values.
Declaration
mixed $data = null,
string $responseCode = '000',
string $responseText = 'Success'
) : PicoResponseBody
{
}
Description
Factory method to create an instance of PicoResponseBody with specific values.
This static method provides an alternative way to instantiate the PicoResponseBody class, allowing you to set the properties directly via parameters.
Parameters
The data returned in the response (optional).
The response code from the service.
The response text or message.
Return
A new instance of PicoResponseBody with the specified values.
Declaration
{
}
Description
Get the primary key associated with the response.
This method returns the primary key that was set during instantiation or via setter.
Return
The primary key, or null if not set.
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key associated with the response.
This method sets the primary key, which can be used to identify or link this response.
Parameters
The primary key to associate with the response.
Return
Returns the current instance for method chaining.
Declaration
string $primaryKey
) : self
{
}
Description
Adds a primary key to the associated data.
This method checks if the data object is not null, and if so, resets the primary key collection and adds the provided primary key to it.
Parameters
The primary key to add
Return
Returns the current instance for method chaining
Declaration
string $primaryKey,
mixed $value
) : self
{
}
Description
Adds a primary key value to the associated data.
This method checks if the data object is not null, and if so, resets the primary key value collection
and adds a new PrimaryKeyValue object with the provided primary key and value.
Parameters
The primary key to add
The value associated with the primary key
Return
Returns the current instance for method chaining
Declaration
MagicObject $entity,
bool $setValue = false
) : self
{
}
Description
Set the entity for the response and automatically determine the primary key.
This method sets the primary key based on the table information from the provided entity.
Parameters
The entity object that contains table information.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the data returned in the response.
This method returns the data associated with the response, which can be of any type.
Return
The data returned in the response.
Declaration
EntityData $data
) : self
{
}
Description
Set the data returned in the response.
This method sets the data associated with the response, which can be of any type.
Parameters
The data to set for the response.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response code from the service or API.
This method returns the response code associated with the service or API response.
Return
The response code.
Declaration
string $responseCode
) : self
{
}
Description
Set the response code from the service or API.
This method sets the response code associated with the service or API response.
Parameters
The response code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message or text from the service or API.
This method returns the response message or text associated with the service or API response.
Return
The response message or text.
Declaration
string $responseText
) : self
{
}
Description
Set the response message or text from the service or API.
This method sets the response message or text associated with the service or API response.
Parameters
The response message or text to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get module
Return
Declaration
ModuleInfo|PicoModule $module,
string $section = null
) : self
{
}
Description
Set module
Parameters
Module
Module section
Return
Declaration
AppUserPermission $appUserPermission
) : self
{
}
Description
Undocumented function
Parameters
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormFilterList
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserFormFilterList
Represents a list of filters to be displayed above a data list in a user form.
This class holds a collection of InputFieldFilter objects, each representing
an individual filter field that can be applied to the data list. Filters are
added to the list using the constructor or the addFilter method.
Properties
Declaration
Description
An array of filter fields to be applied to the data list.
Each filter is represented by an InputFieldFilter object.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputFieldFilter|null $filter = null
)
{
}
Description
Constructor for initializing the filter list.
This constructor initializes an empty filter list and optionally adds a
filter if provided. The filter is an instance of the InputFieldFilter class.
Parameters
An optional filter to add to the list.
Declaration
InputFieldFilter $filter
)
{
}
Description
Add a filter to the filter list.
This method allows for adding an InputFieldFilter object to the list of filters.
Parameters
The filter to be added to the list.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormInputInsert
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserFormInputInsert
Represents a collection of input fields for a user form during an insert operation.
This class is used to manage multiple InputFieldInsert objects, allowing
for the definition and insertion of multiple fields in a form.
Properties
Declaration
Description
An array of input fields to be inserted into the form. Each field is represented by an InputFieldInsert object.
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
InputFieldInsert $input
)
{
}
Description
Add an allowed action to the input.
This method adds an InputFieldInsert object to the list of input that can be performed on the form fields.
Parameters
The InputFieldInsert object to be added.
Declaration
{
}
Description
Get primary key
Return
Declaration
string[] $primaryKey
) : self
{
}
Description
Set primary key
Parameters
Primary key
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormInputUpdate
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserFormInputUpdate
Represents a collection of input fields for a user form during an update operation.
This class manages multiple PicoInputFieldUpdate objects, each representing a field
to be updated in the form. It also includes an array of allowed actions (e.g.,
update, activate, deactivate, delete, approve, reject) that define
the possible operations that can be performed on the form fields.
Properties
Declaration
Description
An array of input fields to be updated into the form. Each field is represented by an PicoInputFieldUpdate object.
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
PicoInputFieldUpdate $input
)
{
}
Description
Add an allowed action to the input.
This method adds an PicoInputFieldUpdate object to the list of input that can be performed on the form fields.
Parameters
The PicoInputFieldUpdate object to be added.
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormOutputApproval
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserFormOutputApproval
Represents a collection of output fields for a user form during an approval operation.
This class manages multiple OutputFieldApproval objects, each representing a field
to be displayed in the form for approval or rejection. It also includes an array of allowed actions
(e.g., approve, reject, update) that define the possible operations that can be performed on the form fields,
as well as the current status of the field, such as whether it is waiting for an action like approval.
Properties
Declaration
Description
An array of output fields to be displayed in the form for approval.
Each field is represented by an OutputFieldApproval object.
Declaration
Description
The current status of the field, typically used to indicate whether the field
is waiting for a specific action, such as approval or rejection.
This is represented by a FieldWaitingFor object.
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
OutputFieldApproval $output
)
{
}
Description
Add an allowed action to the output approval.
This method adds an OutputFieldApproval object to the list of output that can be performed on the form fields.
Parameters
The OutputFieldApproval object to be added.
Declaration
{
}
Description
Get examples include update, activate, deactivate, delete, approve, reject.
Return
Declaration
FieldWaitingFor $waitingfor
) : self
{
}
Description
Set examples include update, activate, deactivate, delete, approve, reject.
Parameters
Examples include update, activate, deactivate, delete, approve, reject.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormOutputDetail
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserFormOutputDetail
Represents a collection of input fields for a user form during an insert operation.
This class manages multiple OutputFieldDetail objects, each representing a field
to be inserted into the form. It also includes an array of allowed actions (e.g.,
update, activate, deactivate, delete, approve, reject) that define
the possible operations that can be performed on the form fields.
Properties
Declaration
Description
An array of input fields to be inserted into the form.
Each field is represented by an OutputFieldDetail object.
Declaration
Description
A list of allowed actions that can be performed on the form fields.
Examples include update, activate, deactivate, delete, approve, reject.
Declaration
Description
Primary key
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
OutputFieldDetail $output
)
{
}
Description
Add an allowed action to the output detail.
This method adds an OutputFieldDetail object to the list of output that can be performed on the form fields.
Parameters
The OutputFieldDetail object to be added.
Declaration
{
}
Description
Get examples include update, activate, deactivate, delete, approve, reject.
Return
Declaration
FieldWaitingFor $waitingFor
) : self
{
}
Description
Set examples include update, activate, deactivate, delete, approve, reject.
Parameters
Examples include update, activate, deactivate, delete, approve, reject.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key(s).
Return
The primary key(s)
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key(s).
Parameters
The primary key(s) to set
Return
Returns the current instance for method chaining
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserFormOutputList
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class UserFormOutputList
Represents a list of output data for a user form, typically used for displaying data in a list or table format. This class manages the headers, which define the structure of the table, and the data items that are part of the list. It also includes a list of allowed actions that can be performed on the fields within the form, such as updating, activating, or deleting records.
Properties
Declaration
Description
An array of PicoDataHeader objects representing the headers of the output list.
Each header defines the structure and sorting behavior for the list.
Declaration
Description
Primary key
Declaration
Description
An array of PicoOutputDataItem objects representing the items in the output row.
Each item contains associated data for the fields in the row.
Declaration
Description
Primary key values
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
PicoDataHeader $header
) : self
{
}
Description
Add a header to the output list.
This method adds a PicoDataHeader object to the list of headers. The header defines the structure and sorting
behavior for the fields in the list or table.
Parameters
The PicoDataHeader object to be added.
Return
Returns the current instance for method chaining.
Declaration
PicoOutputDataItem $dataItem
) : self
{
}
Description
Add a data item to the output list.
This method adds an PicoOutputDataItem object to the list of data items. Each data item represents an individual
item in the list or table, containing the data for each field.
Parameters
The PicoOutputDataItem object to be added.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key.
This method returns the primary key array which is used to identify the unique records in the output list.
Return
The primary key array.
Declaration
string[] $primaryKey
) : self
{
}
Description
Set the primary key.
This method sets the primary key for the output list, which is used for identifying unique records.
Parameters
The primary key array.
Return
Returns the current instance for method chaining.
Declaration
string $column,
string $sortType
) : self
{
}
Description
Set the sorting behavior for a header column.
This method sets the sorting order for a given column header in the list. The sort type can be ascending or descending.
Parameters
The column name to set the sorting for.
The type of sorting ('ASC' for ascending, 'DESC' for descending).
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the primary key values.
Return
The primary key values
Declaration
PrimaryKeyValue[] $primaryKeyValue
) : self
{
}
Description
Set the primary key values.
Parameters
The primary key values to set
Return
Returns the current instance for method chaining
Declaration
string $primaryKey
)
{
}
Description
Adds a primary key to the collection.
This method adds a primary key to the internal array of primary keys. If the collection is not initialized, it initializes it as an empty array before adding the key.
Parameters
The primary key to add to the collection
Declaration
string $name,
mixed $value
)
{
}
Description
Adds a primary key value to the collection.
This method adds a primary key value to the internal array of primary key values. If the collection is not initialized, it initializes it as an empty array before adding the value.
Parameters
The primary key name to add to the collection
The primary key value to add to the collection
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\MocroServices\PicoUserModule
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserModule
Represents a module that is allowed to be accessed by the current user. This class contains information about the module, such as its name, code, and path. It also includes the allowed actions that can be performed within the module and any child modules that may be nested within it.
Properties
Declaration
Description
The name of the module, typically used for display or identification purposes.
Declaration
Description
The unique code that identifies the module, used for referencing or linking purposes.
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The path or URL where the module can be accessed within the application.
Declaration
Description
A list of child modules that are nested within the current module.
Each child module is represented by a PicoUserModule object.
MagicApp\AppDto\MocroServices\PicoUserModuleList
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Class PicoUserModuleList
Represents a collection of user modules that are accessible by the current user.
This class manages a list of UserModule objects, each of which represents a
module that the user has access to. It provides a structure for storing and
managing multiple modules.
Properties
Declaration
Description
An array of UserModule objects representing the modules that the user has access to.
Each module contains information about the module's name, code, path, allowed actions,
and potential child modules.
Methods
Declaration
UserModule|null $userModule = null
)
{
}
Description
Constructor for initializing the user module list.
This constructor initializes an empty user module list and optionally adds a
user module if provided. The user module is an instance of the UserModule class.
Parameters
An optional UserModule to add to the list.
Declaration
UserModule $userModule
)
{
}
Description
Add a user module to the user module list.
This method allows adding an UserModule object to the list of user modules.
Parameters
The UserModule to be added to the list.
MagicApp\AppDto\MocroServices\PicoValueLabelConstructor
Declaration
Package
MagicApp\AppDto\MocroServicesDescription
Base class to construct an object with a value and label.
This class provides a base implementation to store a value and a label, where
the value can be of any type and the label is a string. The class constructor
accepts a required value and an optional label. If no label is provided,
the value is used as the default label.
Properties
Declaration
Description
The value assigned to the object.
Declaration
Description
The label associated with the value.
Declaration
Description
@var string Flag to determine the case format (camelCase or snake_case).
This property controls the case format used in the class, allowing for either camelCase or snake_case. It helps manage how the property names are formatted, depending on the desired case style.
Declaration
Description
@var bool Flag to indicate whether to prettify the output.
This property is a boolean flag that determines if the output should be formatted in a prettier, more readable manner.
When set to true, the output will be prettified; otherwise, it will remain in its default format.
Methods
Declaration
mixed $value = null,
string|null $label = null
)
{
}
Description
Constructor for initializing the object with a value and an optional label.
This constructor accepts a required value, and an optional label. If the label is not provided, the value is used as the label by default.
Parameters
The value to be assigned to the object. This could be a string, integer, or other type.
The label associated with the value. If not provided, the value is used as the label.
Declaration
mixed $value
) : self
{
}
Description
Set the value assigned to the object.
Parameters
The value assigned to the object.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the label associated with the value.
Return
Declaration
string $label
) : self
{
}
Description
Set the label associated with the value.
Parameters
The label associated with the value.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to camelCase. This method allows switching the format for property names to camelCase.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to snake_case. This method allows switching the format for property names to snake_case.
Return
Returns the current instance for method chaining.
Declaration
bool $pretty = true
) : self
{
}
Description
Set the prettify flag for formatting the output.
Parameters
Flag to enable or disable prettifying the output. If true, the output will be prettified.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Sets the case format to specified format. This method allows switching the format for property names to specified format.
Return
Returns the current instance for method chaining.
Declaration
string $string
) : string
{
}
Description
Converts a string to camelCase.
Parameters
The string to convert.
Return
The converted string in camelCase format.
Declaration
string $string
) : string
{
}
Description
Converts a string to snake_case.
Parameters
The string to convert.
Return
The converted string in snake_case format.
Declaration
string $key,
mixed $value
) : bool
{
}
Description
Helper method to determine if a property should be skipped in the conversion.
This method skips the __caseFormat and __prettify property and any property with a null value.
Parameters
The property name.
The property value.
Return
True if the property should be skipped, false otherwise.
Declaration
{
}
Description
Converts the object to an associative array, ignoring properties with a null value.
This method iterates over all public and protected properties of the object, excluding private properties,
and checks each property to exclude those with a value of null.
If the property is an array, it recursively converts any objects within the array to arrays using their toArray() method.
If the property is an object, the toArray() method of the object will be called if it exists.
Return
An associative array representation of the object, excluding null values and private properties.
Declaration
array $data,
string $key,
mixed $value
) : array
{
}
Description
Appends the property data to the associative array, handling array and object properties. This method checks if the property value is an array or object and processes it accordingly.
Parameters
The existing array to append data to.
The property name.
The property value.
Return
The updated array with the appended property data.
Declaration
mixed $value,
object $obj
) : mixed
{
}
Description
Converts an object to a standard PHP object if necessary, handling objects of type self.
Parameters
The value to convert.
The object to check.
Return
The converted value.
Declaration
string $key
) : string
{
}
Description
Apply the chosen case format (camelCase or snake_case) to the given property name. This method applies the selected format (camelCase or snake_case) to the property name.
Parameters
The property name.
Return
The property name in the selected case format.
Declaration
{
}
Description
Overrides the __toString method to serialize the object into a JSON string.
This method calls the toArray() method to convert the object into an array,
and then converts that array into a pretty-printed JSON string.
If the object contains nested objects, their toArray() method is called recursively
to ensure they are properly serialized into the JSON string.
Return
A JSON string representation of the object.
MagicApp\AppDto\ResponseDto\ButtonFormData
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ButtonFormData
A Data Transfer Object (DTO) that represents the data for an HTML button element within a form.
This class encapsulates various attributes commonly used for button elements in HTML forms,
including id, class, value, type, and additional custom attributes.
It provides getter and setter methods for manipulating these properties, and supports method chaining.
This DTO can be used to structure button data for rendering forms or handling form submissions.
Key properties:
element: Specifies the HTML element type (e.g., 'button', 'input').type: Defines the button type (e.g., 'submit', 'reset', 'button').class: The CSS class applied to the button.id: The unique identifier for the button.name: The name attribute of the button, typically used in form submission.value: The value attribute of the button, typically used in form submission.textContent: The text content displayed inside the button.attribute: Additional custom attributes to be added to the button element (e.g., 'data-*' attributes).
Constants
Properties
Declaration
Description
The type of the form element (e.g., 'button', 'input').
Declaration
Description
The type of the button (e.g., 'submit', 'reset', 'button'). This property can be used for input buttons, but is not currently utilized.
Declaration
Description
The CSS class applied to the button element.
Declaration
Description
The unique identifier for the button.
Declaration
Description
The name of the button, typically used in form submission.
Declaration
Description
The value of the button, typically used in form submission.
Declaration
Description
The text content inside the button element.
Declaration
Description
An associative array of additional attributes for the button element.
Methods
Declaration
string $element = 'button',
string|null $type = 'button',
string|null $class = null,
string|null $id = null,
string|null $name = null,
string|null $value = null,
string|null $textContent = null
)
{
}
Description
ButtonFormData constructor.
Initializes the properties of the ButtonFormData object. All properties can be optionally initialized by passing values for each one. Default values are provided for each parameter if none are passed.
Parameters
The type of the button form element (default is 'button').
The type of the button (e.g., 'submit', 'reset', 'button') (default is 'button').
The CSS class applied to the button element (default is null).
The unique identifier for the button element (default is null).
The name attribute of the button (default is null).
The value attribute of the button (default is null).
The text content inside the button element (default is null).
Declaration
{
}
Description
Get the element type.
Return
The type of the form element.
Declaration
string $element
) : self
{
}
Description
Set the element type.
Parameters
The element type (e.g., 'button', 'input').
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the button type (e.g., 'submit', 'reset', 'button').
Returns the type of the button.
Return
The type of the button.
Declaration
string $type
) : self
{
}
Description
Set the button type (e.g., 'submit', 'reset', 'button').
Sets the type of the button (such as 'submit', 'reset', or 'button').
Parameters
The button type (e.g., 'submit', 'reset', 'button').
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the CSS class applied to the button.
Return
The CSS class.
Declaration
string $class
) : self
{
}
Description
Set the CSS class for the button.
Parameters
The CSS class to apply to the button.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the ID of the button.
Return
The unique ID of the button.
Declaration
string $id
) : self
{
}
Description
Set the ID of the button.
Parameters
The unique identifier for the button.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the name of the button.
Return
The name attribute of the button.
Declaration
string $name
) : self
{
}
Description
Set the name of the button.
Parameters
The name of the button.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the value of the button.
Return
The value attribute of the button.
Declaration
string $value
) : self
{
}
Description
Set the value of the button.
Parameters
The value to set for the button.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the text content of the button.
Return
The text content inside the button element.
Declaration
string $textContent
) : self
{
}
Description
Set the text content of the button.
Parameters
The text content inside the button element.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the additional attributes for the button.
Return
The associative array of additional attributes.
Declaration
array $attribute
) : self
{
}
Description
Set the additional attributes for the button.
Parameters
The associative array of attributes to set for the button.
Return
Returns the current instance for method chaining.
Declaration
string $key,
string $value
) : self
{
}
Description
Add a new attribute to the button. If the attribute key already exists, the value will be updated.
Parameters
The attribute key (e.g., 'data-toggle')
The attribute value (e.g., 'modal')
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ColumnDataDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) representing a column in a tabular data structure.
The ColumnDataDto class encapsulates the properties of a column, including its field name, associated values, data types, and display characteristics. It is designed to facilitate the representation and manipulation of data within a column context, allowing for additional features such as read-only status and visibility control.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The name of the field.
Declaration
Description
The label for the field, typically used in user interfaces.
Declaration
Description
The value associated with the field for display purposes.
Declaration
Description
The raw value associated with the field.
Declaration
Description
The data type of the field.
Declaration
Description
Indicates whether the field is read-only.
Declaration
Description
Indicates whether the field is hidden from the user interface.
Declaration
Description
The draft value associated with the field for temporary storage.
Declaration
Description
The raw draft value associated with the field.
Methods
Declaration
string $field,
ValueDto $value,
string $type,
string $label,
bool $readonly = false,
bool $hidden = false,
ValueDto $valueDraft = null
)
{
}
Description
Constructor to initialize properties of the ColumnDataDto class.
Parameters
The name of the field.
The value associated with the field.
The data type of the field.
The label for the field.
Indicates if the field is read-only.
Indicates if the field is hidden.
The draft value associated with the field.
Declaration
{
}
Description
Get the name of the field.
Return
The name of the field.
Declaration
string $field
) : self
{
}
Description
Set the name of the field and return the current instance for method chaining.
Parameters
The name of the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the value associated with the field.
Return
The value associated with the field.
Declaration
mixed $value
) : self
{
}
Description
Set the value associated with the field and return the current instance for method chaining.
Parameters
The value to associate with the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the type of the field.
Return
The type of the field.
Declaration
string $type
) : self
{
}
Description
Set the type of the field and return the current instance for method chaining.
Parameters
The type to set for the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the label for the field.
Return
The label for the field.
Declaration
string $label
) : self
{
}
Description
Set the label for the field and return the current instance for method chaining.
Parameters
The label to set for the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if the field is read-only.
Return
True if the field is read-only, otherwise false.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only status of the field and return the current instance for method chaining.
Parameters
Indicates if the field should be read-only.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if the field is hidden.
Return
True if the field is hidden, otherwise false.
Declaration
bool $hidden
) : self
{
}
Description
Set the hidden status of the field and return the current instance for method chaining.
Parameters
Indicates if the field should be hidden.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the draft value associated with the field.
Return
The draft value associated with the field.
Declaration
mixed $valueDraft
) : self
{
}
Description
Set the draft value associated with the field and return the current instance for method chaining.
Parameters
The draft value to associate with the field.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ColumnDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ColumnDto
Represents a data structure for a column in a table or grid-like layout, typically used for displaying
rows of data. Each ColumnDto object contains the data for the column (represented by an array of ColumnDataDto objects),
as well as associated metadata (represented by a MetadataDto object) which provides additional information
about the column, such as its title, type, or other descriptive attributes.
This class is primarily used for managing and structuring data and metadata related to a column in a larger dataset, such as a form, table, or report.
Properties:
data: An array ofColumnDataDtoobjects, each representing a piece of data within the column.-
metadata: An instance of theMetadataDtoclass containing additional metadata related to the column.Methods:
getData(): Retrieves the data associated with the column.setData(array $data): Sets the data for the column and returns the current instance.addData(ColumnDataDto $columnData): Adds a singleColumnDataDtoto thedataarray and returns the current instance.getMetadata(): Retrieves the metadata associated with the column.setMetadata(MetadataDto $metadata): Sets the metadata for the column and returns the current instance.
Constants
Properties
Declaration
Description
Data associated with the row.
Declaration
Description
Metadata associated with the row.
Methods
Declaration
{
}
Description
ColumnDto constructor.
Initializes the data property as an empty array and creates a new MetadataDto instance for the
metadata property.
Declaration
{
}
Description
Gets the data associated with the column.
Return
The array of ColumnDataDto objects.
Declaration
ColumnDataDto[] $data
) : self
{
}
Description
Sets the data for the column.
Parameters
The array of ColumnDataDto objects to set.
Return
Returns the current instance for method chaining.
Declaration
ColumnDataDto $columnData
) : self
{
}
Description
Adds a single ColumnDataDto to the data array.
Parameters
The ColumnDataDto object to add.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Gets the metadata associated with the row.
Return
The metadata associated with the row.
Declaration
MetadataDto $metadata
) : self
{
}
Description
Sets the metadata associated with the row.
Parameters
The metadata to set for the column.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ConstantDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class that defines constants used throughout the application.
The ConstantDto class serves as a container for commonly used string constants that
are used across the application. These constants can represent field names, keys,
or other values that need to be consistent throughout the codebase.
This pattern ensures that string literals are centralized and avoids the use of "magic strings" in the application code, providing easier maintenance and reducing the risk of typos or inconsistencies.
Constants
MagicApp\AppDto\ResponseDto\CreateForm
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class CreateForm
Represents the response structure for a list-based form in a UI. This class holds metadata
about the module that the form is associated with, such as the module's ID, name, and title,
as well as the status of the request (via the response code and message). It also contains
the main data structure (CreateFormData) that holds the filter and data controls for the list.
The CreateForm class is used to encapsulate all necessary information for rendering a form
that interacts with a list of data. It provides details about the module's context and
feedback about the request, as well as the controls and data required for filtering and
displaying the list content in the UI.
Key Features:
- Hold the metadata about the module (ID, name, and title).
- Provide the response status and message for request feedback.
- Contain the
CreateFormDatastructure, which manages the list's filter and data controls. - Allow easy access to the response details and the data form structure.
Constants
Properties
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The ID of the module associated with the data.
Declaration
Description
The name of the module associated with the data.
Declaration
Description
The title of the module associated with the data.
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The main data structure containing the list form.
Methods
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module ID associated with the data.
Return
The module ID.
Declaration
string $moduleId
) : self
{
}
Description
Set the module ID associated with the data.
Parameters
The module ID to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module name associated with the data.
Return
The module name.
Declaration
string $moduleName
) : self
{
}
Description
Set the module name associated with the data.
Parameters
The module name to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module title associated with the data.
Return
The module title.
Declaration
string $moduleTitle
) : self
{
}
Description
Set the module title associated with the data.
Parameters
The module title to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response code indicating the status of the request.
Return
The response code.
Declaration
string|null $responseCode
) : self
{
}
Description
Set the response code indicating the status of the request.
Parameters
The response code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message providing additional information about the response.
Return
The response message.
Declaration
string|null $responseMessage
) : self
{
}
Description
Set the response message providing additional information about the response.
Parameters
The response message to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the main data structure containing the list form.
Return
The data structure for the form.
Declaration
CreateFormData|null $data
) : self
{
}
Description
Set the main data structure containing the list form.
Parameters
The data structure to set.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\CreateFormData
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class CreateFormData
Represents a data structure for creating form filters or input elements in the UI. This class handles the configuration for a filter or form input, such as the filter's label, field name, input type, default value, and other attributes.
The class contains a column property, which is an array of InputFormData objects. Each InputFormData
represents a column or field in the form, such as a filter or search field.
Properties:
column: An array ofInputFormDataobjects, each representing a column or input field in the form.button: An array ofButtonFormDataobjects, each representing a button in the form.
Constants
Properties
Declaration
Description
The columns or input fields associated with the form.
This property holds an array of InputFormData objects, each representing a column or filter element.
Declaration
Description
The buttons associated with the form.
This property holds an array of ButtonFormData objects, each representing a button within the form.
Methods
Declaration
{
}
Description
CreateFormData constructor.
Initializes the column property as an empty array.
Initializes the button property as an empty array.
Declaration
{
}
Description
Gets the array of InputFormData objects representing the columns or input fields.
Return
The array of InputFormData objects representing the columns.
Declaration
InputFormData[] $column
) : self
{
}
Description
Sets the array of InputFormData objects representing the columns or input fields.
Parameters
The array of InputFormData objects to set.
Return
Returns the current instance for method chaining.
Declaration
InputFormData $inputFormData
) : self
{
}
Description
Adds a single InputFormData object to the column array.
This method allows you to append one InputFormData object at a time to the column property.
Parameters
The InputFormData object to add to the column.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Gets the array of ButtonFormData objects associated with the form.
Return
The array of ButtonFormData objects.
Declaration
ButtonFormData[] $button
) : self
{
}
Description
Sets the array of ButtonFormData objects representing the buttons in the form.
Parameters
The array of ButtonFormData objects to set.
Return
Returns the current instance for method chaining.
Declaration
ButtonFormData $buttonFormData
) : self
{
}
Description
Adds a single ButtonFormData object to the button array.
Parameters
The ButtonFormData object to add to the button array.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\DataMap
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class DataMap
Represents a mapping of fields to their corresponding values or definitions. This class contains a field name and an associative array that defines how the field is mapped, allowing for flexible data transformation and retrieval.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The name of the field being mapped.
Declaration
Description
An associative array representing the mapping of the field.
Methods
Declaration
string $field,
array $map
)
{
}
Description
Constructor for initializing a DataMap instance.
Parameters
The name of the field.
An associative array defining the mapping for the field.
Declaration
{
}
Description
Get the name of the field.
Return
The name of the field.
Declaration
string $field
) : self
{
}
Description
Set the name of the field.
Parameters
The name of the field.
Return
The instance of this class for method chaining.
Declaration
{
}
Description
Get the mapping for the field.
Return
The mapping for the field.
Declaration
array $map
) : self
{
}
Description
Set the mapping for the field.
Parameters
The mapping for the field.
Return
The instance of this class for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\DetailDataDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class DetailDataDto
Represents the data structure for a table, including column titles and rows. This class manages the titles of column, a data map, and the rows of data represented as RowDto instances. It provides methods for appending titles, data maps, and rows, as well as resetting these structures.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The name of the primary key in the data structure.
Declaration
Description
An associative array mapping primary key names to their data types.
Declaration
Description
An array of column, each represented as a ColumnDto.
Declaration
Description
Data control
Methods
Declaration
{
}
Description
Initializes the object and sets up the necessary properties. This constructor creates a new instance of ColumnDto for the column property and initializes an empty array for the dataControl property.
Declaration
{
}
Description
Get the name of the primary key in the data structure.
Return
The name of the primary key.
Declaration
string[]|null $primaryKeyName
) : self
{
}
Description
Set the name of the primary key in the data structure.
Parameters
The name of the primary key.
Return
Returns the current instance for method chaining.
Declaration
string $primaryKeyName,
string $primaryKeyDataType
) : self
{
}
Description
Add a primary key name and its data type to the list of primary keys.
This method initializes the primary key name and data type properties as arrays if they haven't been set, then appends the new primary key name and its corresponding data type to the lists.
Parameters
The primary key name to add.
The primary key data type to add.
Return
The instance of this class for method chaining.
Declaration
string $field,
mixed $value,
string $type,
string $label,
bool $readonly,
bool $hidden,
mixed $valueDraft
) : self
{
}
Description
Append a row of data to the table.
This method adds a new row to the internal column collection using the provided parameters to create a ColumnDto instance.
Parameters
The name of the field.
The value associated with the field.
The type of the field.
The label for the field.
Indicates if the field is read-only.
Indicates if the field is hidden.
The draft value associated with the field.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get an array of column, each represented as a ColumnDto.
Return
The column in the data structure.
Declaration
ColumnDto[] $column
) : self
{
}
Description
Set an array of column, each represented as a ColumnDto.
Parameters
An array of column to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieves the associative array mapping primary key names to their data types.
This method returns the current mapping of primary key names to their associated data types as an associative array, where the keys are the primary key names and the values are their respective data types.
Return
An associative array where the keys are primary key names and the values are data types.
Declaration
string[] $primaryKeyDataType
) : self
{
}
Description
Sets an associative array mapping primary key names to their data types.
This method allows setting or updating the mapping of primary key names to their respective data types. The argument should be an associative array where each key represents a primary key name and the corresponding value is the data type.
Parameters
An associative array mapping primary key names to their data types.
Return
Returns the current instance for method chaining.
Declaration
string $name,
string $type
) : self
{
}
Description
Appends or updates the data type for a specific primary key name.
This method allows appending a new primary key name and its associated data type to the existing
mapping or updating the data type of an existing primary key name. The primary key name is
specified as the $name argument, and the data type is specified as the $type argument.
Parameters
The primary key name to be added or updated in the mapping.
The data type to be associated with the primary key name.
Return
Returns the current instance for method chaining.
Declaration
ButtonFormData $dataControl
) : self
{
}
Description
Adds a ButtonFormData object to the internal collection of data controls. This method stores the given data control for further use or processing.
Parameters
The ButtonFormData object to be added to the collection.
Return
Returns the current object instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\DetailDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) for displaying records in a table format.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The ID of the module associated with the data.
Declaration
Description
The name of the module associated with the data.
Declaration
Description
The title of the module associated with the data.
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The main data structure containing the list of items.
Methods
Declaration
string|null $responseCode,
string|null $responseMessage,
DetailDataDto $data
)
{
}
Description
Constructor for initializing the DetailDto instance.
Parameters
The response code.
The response message.
The main data structure.
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the main data structure containing the detail columns.
Return
The detail data structure.
Declaration
string $field,
ValueDto $value,
string|null $type = null,
string|null $label = null,
bool $readonly = false,
bool $hidden = false,
ValueDto|null $valueDraft = null
) : self
{
}
Description
Add a new detail column.
This method creates a new DetailColumnDto and appends it to the detail data structure.
Parameters
The field associated with the detail.
The value associated with the detail.
The type of the value.
The label describing the detail.
Whether the detail is readonly.
Whether the detail is hidden.
The value associated with the draft data.
Return
The instance of this class for method chaining.
Declaration
string $primaryKeyName,
string $primaryKeyDataType
) : self
{
}
Description
Add a primary key name and its data type to the list of primary keys.
This method initializes the primary key name and data type properties as arrays if they haven't been set, then appends the new primary key name and its corresponding data type to the lists.
Parameters
The primary key name to add.
The primary key data type to add.
Return
The instance of this class for method chaining.
Declaration
MetadataDto $metadata
) : self
{
}
Description
Set metadata associated with the row.
Parameters
Metadata associated with the row.
Return
Returns the current instance for method chaining.
Declaration
ButtonFormData $dataControl
) : self
{
}
Description
Adds a data control to the data object. This function allows for the addition of a data control to be managed by the current object.
Parameters
The ButtonFormData object containing the data control to be added.
Return
Returns the current object instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\InputFormData
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class InputFormData
Represents a filter or form input element in a UI, typically used in a search or filter form. This class stores information about the filter's configuration, such as the label, field name, input type, default value, and other attributes that define how the filter will be displayed and interacted with in the UI.
It supports various input types such as text, number, date, datetime, select, and button, allowing flexibility in how the filter is rendered. Additionally, it provides methods for setting and retrieving the filter properties, and supports chaining of setter methods.
Properties:
label: The label that will be displayed next to the filter input element.field: The field name in the data model to which this filter corresponds.name: A unique identifier for the filter in the UI.id: A unique identifier for the filter control, used for DOM manipulation.element: The type of HTML input element used for the filter (e.g., "text", "select").attribute: An array of additional HTML attributes to apply to the filter element (e.g., class, style).textContent: The text label for button elements (e.g., "Apply", "Reset").selectOption: The select options for select input elements, represented as aSelectOptionDtoobject.defaultValue: The default value for the filter input, which is pre-filled when the form is loaded.
Constants
Properties
Declaration
Description
The label that will be displayed next to the filter input element. This is the text that describes the purpose of the filter field.
Declaration
Description
The field name that this filter corresponds to in the data model. Typically, this is the name of the property or column being filtered in the backend.
Declaration
Description
A unique name or identifier for this filter, used to reference the filter in the user interface.
Declaration
Description
The unique identifier for the filter control element, typically used for DOM element identification. This is often used in JavaScript to manipulate or target the element.
Declaration
Description
The type of HTML input element used for the filter. The available types include:
- "text": For text input fields.
- "number": For numeric input fields.
- "date": For date input fields.
- "datetime": For date-time input fields.
- "checkbox": For checkbox input fields.
- "select": For drop-down select lists.
- "button": For button elements, typically used for applying or resetting the filter.
Declaration
Description
An associative array of HTML attributes to apply to the filter element. This can include attributes like "class", "id", "style", "placeholder", and others to customize the appearance or behavior.
Declaration
Description
The text content for button elements, used to define the button's label (e.g., "Apply", "Reset"). This is applicable when the element type is "button".
Declaration
Description
Select option for "select" input elements, represented by a SelectOptionDto object.
This defines the options available for the user to choose from in a select input field.
Declaration
Description
The default value for the filter input. This is the value that will be pre-filled or selected when the form is loaded.
Methods
Declaration
{
}
Description
Get the label for the filter.
Return
The label of the filter.
Declaration
string $label
) : self
{
}
Description
Set the label for the filter.
Parameters
The label to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the field name associated with this filter.
Return
The field name of the filter.
Declaration
string $field
) : self
{
}
Description
Set the field name associated with this filter.
Parameters
The field name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the unique name or identifier for this filter.
Return
The name of the filter.
Declaration
string $name
) : self
{
}
Description
Set the unique name or identifier for this filter.
Parameters
The name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the unique identifier for the filter control element.
Return
The ID of the filter control.
Declaration
string $id
) : self
{
}
Description
Set the unique identifier for the filter control element.
Parameters
The ID to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the type of HTML input element used for the filter.
Return
The input element type.
Declaration
string $element
) : self
{
}
Description
Set the type of HTML input element used for the filter.
Parameters
The element type to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the HTML attributes for the filter element.
Return
The attributes of the filter.
Declaration
array $attribute
) : self
{
}
Description
Set the HTML attributes for the filter element.
Parameters
The attributes to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the text content for button elements.
Return
The text content of the button (e.g., "Apply", "Reset").
Declaration
string $textContent
) : self
{
}
Description
Set the text content for button elements.
Parameters
The button text content to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the select option associated with the filter.
Return
The select option.
Declaration
SelectOptionDto $selectOption
) : self
{
}
Description
Set the select option for the filter.
Parameters
The select option to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the default value for the filter input.
Return
The default value of the filter.
Declaration
mixed $defaultValue
) : self
{
}
Description
Set the default value for the filter input.
Parameters
The default value to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListDataControl
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ListDataControl
Represents a filter control element for use in a list filter UI. This class holds the metadata and attributes for the filter input element, including its label, field name, and the associated HTML attributes and text content.
Constants
Properties
Declaration
Description
The field name that this filter corresponds to in the data model. This is typically the name of the property or column being filtered.
Declaration
Description
A unique name or identifier for this filter, used to reference the filter in the UI.
Declaration
Description
The unique identifier for the filter control, typically used for DOM element identification.
Declaration
Description
The type of HTML input element used for the filter. This can be one of the following types:
- "text": For text input fields.
- "number": For numeric input fields.
- "date": For date input fields.
- "datetime": For date-time input fields.
- "checkbox": For checkbox input fields.
- "select": For drop-down select lists.
- "button": For button elements, typically used for submitting or resetting the filter.
Declaration
Description
An associative array of HTML attributes to apply to the filter element. This can include attributes like "class", "id", "style", "placeholder", etc.
Declaration
Description
The text content for button elements, used to define the button's label (e.g., "Apply", "Reset").
Methods
Declaration
{
}
Description
Gets the field name associated with the filter.
Return
The field name.
Declaration
string $field
) : self
{
}
Description
Sets the field name associated with the filter.
Parameters
The field name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the unique name for the filter.
Return
The unique name.
Declaration
string $name
) : self
{
}
Description
Sets the unique name for the filter.
Parameters
The name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the unique identifier for the filter control.
Return
The ID.
Declaration
string $id
) : self
{
}
Description
Sets the unique identifier for the filter control.
Parameters
The ID to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the type of HTML element used for the filter input.
Return
The input element type (e.g., "text", "number").
Declaration
string $element
) : self
{
}
Description
Sets the type of HTML element used for the filter input.
Parameters
The element type to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the HTML attributes associated with the filter element.
Return
The array of HTML attributes.
Declaration
array $attribute
) : self
{
}
Description
Sets the HTML attributes associated with the filter element.
Parameters
The attributes to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the text content for button elements.
Return
The text content for button elements.
Declaration
string $textContent
) : self
{
}
Description
Sets the text content for button elements.
Parameters
The text content to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListDataDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ListDataDto
Represents the data structure for a table, including column titles and row. This class manages the titles of columns, a data map, and the row of data represented as RowDto instances. It provides methods for appending titles, data maps, and row, as well as resetting these structures.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
An array of column titles for the data table.
Declaration
Description
An array of data maps for the data table.
Declaration
Description
The name of the primary key in the data structure.
Declaration
Description
An associative array mapping primary key names to their data types.
Declaration
Description
Current page
Declaration
Description
An array of row, each represented as a RowDto.
Declaration
Description
Data control
Methods
Declaration
{
}
Description
Initializes the object and sets up the necessary properties.
This constructor initializes the row property as an empty array and
the dataControl property as an empty array.
Declaration
{
}
Description
Get the name of the primary key in the data structure.
Return
Declaration
string[]|null $primaryKeyName
) : self
{
}
Description
Set the name of the primary key in the data structure.
Parameters
The name of the primary key.
Return
Returns the current instance for method chaining.
Declaration
string $primaryKeyName,
string $primaryKeyDataType
) : self
{
}
Description
Add a primary key name and its data type to the list of primary keys.
This method initializes the primary key name and data type properties as arrays if they haven't been set, then appends the new primary key name and its corresponding data type to the lists.
Parameters
The primary key name to add.
The primary key data type to add.
Return
The instance of this class for method chaining.
Declaration
ListDataTitleDto $title
) : self
{
}
Description
Append a column title to the table.
Parameters
The title to append.
Return
Returns the current instance for method chaining.
Declaration
DataMap $dataMap
) : self
{
}
Description
Append a data map to the table.
Parameters
The data map to append.
Return
Returns the current instance for method chaining.
Declaration
MagicObject $data,
MetadataDto $metadata
) : self
{
}
Description
Append a row of data to the table.
This method adds a new row to the internal row collection using the provided MagicObject as data along with the associated MetadataDto.
Parameters
The row data to append.
The metadata associated with the row data.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get an array of column titles for the data table.
Return
The column titles.
Declaration
{
}
Description
Reset the column titles to an empty array.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the data map for the table.
Return
The data map.
Declaration
{
}
Description
Reset the data map to an empty array.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get an array of row for the data table.
Return
The row of data.
Declaration
{
}
Description
Reset the row to an empty array.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get current page
Return
Declaration
PageDto $page
) : self
{
}
Description
Set current page
Parameters
Current page
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get an associative array mapping primary key names to their data types.
Return
Declaration
string[] $primaryKeyDataType
) : self
{
}
Description
Set an associative array mapping primary key names to their data types.
Parameters
An associative array mapping primary key names to their data types.
Return
Returns the current instance for method chaining.
Declaration
DataMap[] $dataMap
) : self
{
}
Description
Set an array of data maps for the data table.
Parameters
An array of data maps for the data table.
Return
Returns the current instance for method chaining.
Declaration
ButtonFormData $dataControl
) : self
{
}
Description
Adds a ButtonFormData object to the internal collection of data controls. This method stores the given data control for further use or processing.
Parameters
The ButtonFormData object to be added to the collection.
Return
Returns the current object instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListDataTitleDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Represents the title of a column in a table row.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The field associated with the column title.
Declaration
Description
The display value of the column title.
Declaration
Description
Indicates if the column is sortable.
Declaration
Description
The current sort direction (ASC/DESC).
Methods
Declaration
string|null $field = null,
string|null $label = null,
bool $sortable = false,
string|null $currentSort = null
)
{
}
Description
Constructor to initialize the column title.
Parameters
The field associated with the column title.
The display value of the column title.
Indicates if the data can be sorted by this column.
The current sort direction (ASC/DESC).
Declaration
{
}
Description
Get the field associated with the column title.
Return
Declaration
string|null $field
) : self
{
}
Description
Set the field associated with the column title.
Parameters
The field associated with the column title.
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the display value of the column title.
Return
Declaration
string|null $label
) : self
{
}
Description
Set the display value of the column title.
Parameters
The display value of the column title.
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Check if the column is sortable.
Return
Declaration
bool $sortable
) : self
{
}
Description
Set the sortable status of the column.
Parameters
Indicates if the column is sortable.
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Get the current sort direction (ASC/DESC).
Return
Declaration
string|null $currentSort
) : self
{
}
Description
Set the current sort direction.
Parameters
The current sort direction (ASC/DESC).
Return
The current instance, allowing method chaining
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) for displaying records in a table format.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The ID of the module associated with the data.
Declaration
Description
The name of the module associated with the data.
Declaration
Description
The title of the module associated with the data.
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The main data structure containing the list of items.
Methods
Declaration
string|null $responseCode = null,
string|null $responseMessage = null,
mixed $data = null
)
{
}
Description
Constructor to initialize properties.
Parameters
The response code.
The response message.
The associated data.
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
PicoPageable|PicoPage|PageDto|array|null $pageable
) : self
{
}
Description
Sets the pagination details for the current object.
This method assigns a PageDto instance to the object. It accepts various types
of input to initialize the pagination details:
- A
PicoPageableobject, which contains the page and page size details. - A
PicoPageobject, which provides the page number and page size. - A
PageDtoobject, which copies pagination information from anotherPageDto. -
An
arraycontaining the page number and page size (array format: [page_number, page_size]).If no input is provided, the pagination is set to the default values from the constructor of
PageDto(page 1, page size 10).
Parameters
A pagination object or array providing
Return
Returns the current instance for method chaining.
Declaration
ListDataTitleDto $title
) : self
{
}
Description
Append a column title to the table.
Parameters
The title to append.
Return
Returns the current instance for method chaining.
Declaration
DataMap $dataMap
) : self
{
}
Description
Add a data map to the collection.
This method appends a DataMap instance to the internal data map collection. If the collection does not exist, it initializes it first. Each DataMap is stored in the data structure.
Parameters
The DataMap instance to add.
Return
Returns the current instance for method chaining.
Declaration
array|stdClass|MagicObject|SetterGetter|PicoGenericObject $title
) : self
{
}
Description
Add a column title to the table.
This method accepts various types of input to create a column title, including associative arrays, stdClass objects, and instances of MagicObject, SetterGetter, or PicoGenericObject. It extracts the name and value for the title and appends it to the data structure.
Parameters
The title to add, which can be:
Return
Returns the current instance for method chaining.
Declaration
string $primaryKeyName,
string $primaryKeyDataType
) : self
{
}
Description
Add a primary key name and its data type to the list of primary keys.
This method initializes the primary key name and data type properties as arrays if they haven't been set, then appends the new primary key name and its corresponding data type to the lists.
Parameters
The primary key name to add.
The primary key data type to add.
Return
The instance of this class.
Declaration
MagicObject $data,
MetadataDto $metadata
) : self
{
}
Description
Append a row of data to the table.
This method adds a new row of data to the internal data collection, creating a ListDataDto instance if it doesn't already exist.
Parameters
The row data to append.
The metadata associated with the row data.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response code indicating the status of the request.
Return
Declaration
string|null $responseCode
) : self
{
}
Description
Set the response code indicating the status of the request.
Parameters
The response code indicating the status of the request.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get a message providing additional information about the response.
Return
Declaration
string|null $responseMessage
) : self
{
}
Description
Set a message providing additional information about the response.
Parameters
A message providing additional information about the response.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the main data structure containing the list of items.
Return
The main data structure.
Declaration
ButtonFormData $dataControl
) : self
{
}
Description
Adds a data control to the data object. This function allows for the addition of a data control to be managed by the current object.
Parameters
The ButtonFormData object containing the data control to be added.
Return
Returns the current object instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListFilterControl
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ListFilterControl
Represents a filter control element for use in a list filter UI. This class holds the metadata and attributes for the filter input element, including its label, field name, and the associated HTML attributes and text content.
Constants
Properties
Declaration
Description
The label that will be displayed next to the filter input element.
Declaration
Description
The field name that this filter corresponds to in the data model. This is typically the name of the property or column being filtered.
Declaration
Description
A unique name or identifier for this filter, used to reference the filter in the UI.
Declaration
Description
The unique identifier for the filter control, typically used for DOM element identification.
Declaration
Description
The type of HTML input element used for the filter. This can be one of the following types:
- "text": For text input fields.
- "number": For numeric input fields.
- "date": For date input fields.
- "datetime": For date-time input fields.
- "checkbox": For checkbox input fields.
- "select": For drop-down select lists.
- "button": For button elements, typically used for submitting or resetting the filter.
Declaration
Description
An associative array of HTML attributes to apply to the filter element. This can include attributes like "class", "id", "style", "placeholder", etc.
Declaration
Description
The text content for button elements, used to define the button's label (e.g., "Apply", "Reset").
Declaration
Description
Select option
Methods
Declaration
{
}
Description
Gets the label of the filter input element.
Return
The label.
Declaration
string $label
) : self
{
}
Description
Sets the label of the filter input element.
Parameters
The label to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the field name associated with the filter.
Return
The field name.
Declaration
string $field
) : self
{
}
Description
Sets the field name associated with the filter.
Parameters
The field name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the unique name for the filter.
Return
The unique name.
Declaration
string $name
) : self
{
}
Description
Sets the unique name for the filter.
Parameters
The name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the unique identifier for the filter control.
Return
The ID.
Declaration
string $id
) : self
{
}
Description
Sets the unique identifier for the filter control.
Parameters
The ID to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the type of HTML element used for the filter input.
Return
The input element type (e.g., "text", "number").
Declaration
string $element
) : self
{
}
Description
Sets the type of HTML element used for the filter input.
Parameters
The element type to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the HTML attributes associated with the filter element.
Return
The array of HTML attributes.
Declaration
array $attribute
) : self
{
}
Description
Sets the HTML attributes associated with the filter element.
Parameters
The attributes to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the text content for button elements.
Return
The text content for button elements.
Declaration
string $textContent
) : self
{
}
Description
Sets the text content for button elements.
Parameters
The text content to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListForm
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ListForm
Represents the response structure for a list-based form in a UI. This class holds metadata
about the module that the form is associated with, such as the module's ID, name, and title,
as well as the status of the request (via the response code and message). It also contains
the main data structure (ListFormData) that holds the filter and data controls for the list.
The ListForm class is used to encapsulate all necessary information for rendering a form
that interacts with a list of data. It provides details about the module's context and
feedback about the request, as well as the controls and data required for filtering and
displaying the list content in the UI.
Key Features:
- Hold the metadata about the module (ID, name, and title).
- Provide the response status and message for request feedback.
- Contain the
ListFormDatastructure, which manages the list's filter and data controls. - Allow easy access to the response details and the data form structure.
Constants
Properties
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The ID of the module associated with the data.
Declaration
Description
The name of the module associated with the data.
Declaration
Description
The title of the module associated with the data.
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The main data structure containing the list form.
Methods
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module ID associated with the data.
Return
The module ID.
Declaration
string $moduleId
) : self
{
}
Description
Set the module ID associated with the data.
Parameters
The module ID to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module name associated with the data.
Return
The module name.
Declaration
string $moduleName
) : self
{
}
Description
Set the module name associated with the data.
Parameters
The module name to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module title associated with the data.
Return
The module title.
Declaration
string $moduleTitle
) : self
{
}
Description
Set the module title associated with the data.
Parameters
The module title to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response code indicating the status of the request.
Return
The response code.
Declaration
string|null $responseCode
) : self
{
}
Description
Set the response code indicating the status of the request.
Parameters
The response code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message providing additional information about the response.
Return
The response message.
Declaration
string|null $responseMessage
) : self
{
}
Description
Set the response message providing additional information about the response.
Parameters
The response message to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the main data structure containing the list form.
Return
The data structure for the form.
Declaration
ListFormData|null $data
) : self
{
}
Description
Set the main data structure containing the list form.
Parameters
The data structure to set.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ListFormData
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ListFormData
Represents a form structure designed to manage and organize filtering and data controls within a list UI. This class serves as a container for filter controls (e.g., search fields, date pickers, checkboxes) and data controls (e.g., display settings, sorting, pagination). These controls enable users to interact with and manipulate the data displayed in the list.
The ListFormData class allows for easy configuration of various filters and data-related
controls, such as adding, removing, or modifying filters and data controls dynamically.
It also provides methods to manage the controls collectively, ensuring that the UI is
adaptable and user-friendly for operations such as sorting, searching, and displaying data.
Key Features:
- Manage a list of filter controls, each representing a specific filter UI element.
- Manage a list of data controls, each representing a specific data-related UI element.
- Dynamic addition of filter and data controls.
- Chaining of method calls for adding controls and setting properties.
Constants
Properties
Declaration
Description
An array of filter control elements used for filtering data in the list.
Each element is an instance of ListFilterControl, which holds metadata
about the filter control (e.g., field, label, element type).
Declaration
Description
An array of data control elements used for managing and displaying
the actual data in the list. Each element is an instance of DataControl,
which holds information about the data field and its representation.
Methods
Declaration
{
}
Description
Constructor for the ListFormData class.
Initializes the filter control and data control arrays as empty. This default constructor is useful when you want to create an object without initializing the controls right away.
Declaration
ListFilterControl $filterControl
) : self
{
}
Description
Adds a filter control to the list of filter controls.
Parameters
The filter control to add.
Return
Returns the current instance for chaining.
Declaration
DataControl $dataControl
) : self
{
}
Description
Adds a data control to the list of data controls.
Parameters
The data control to add.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the array of filter control elements.
Return
The array of filter control elements.
Declaration
ListFilterControl[] $filterControl
) : self
{
}
Description
Sets the array of filter control elements.
Parameters
The filter controls to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the array of data control elements.
Return
The array of data control elements.
Declaration
DataControl[] $dataControl
) : self
{
}
Description
Sets the array of data control elements.
Parameters
The data controls to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\MetadataDetailDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) representing detailed metadata information.
The MetadataDetailDto class extends the MetadataDto class to provide specific details related to metadata associated with data operations. It includes properties that indicate the status of operations, the primary key associated with the metadata, and its active status. This class is particularly useful for scenarios requiring detailed tracking of metadata operations, such as in data approval processes, updates, or state changes.
The class provides methods for accessing and manipulating these properties while leveraging inheritance from the MetadataDto class for common metadata functionalities.
The class also extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
Associated array key value primary key.
Declaration
Description
Indicates whether the metadata is active.
Declaration
Description
Represents the status of the operation.
Possible values:
- 1: approval for new data
- 2: approval for updating data
- 3: approval for activate
- 4: approval for deactivate
- 5: approval for delete
- 6: approval for sort order
Declaration
Description
Code representing the waiting status.
Declaration
Description
Message associated with the waiting status.
Methods
Declaration
array $primaryKey,
bool $active,
int $waitingFor,
string $waitingForCode,
string $waitingForMessage
)
{
}
Description
Constructor to initialize properties of the MetadataDetailDto class.
Parameters
An array representing the primary key.
A boolean indicating if the metadata is active.
An integer representing the operation status.
A code representing the waiting status.
A message associated with the waiting status.
Declaration
{
}
Description
Get the primary key associated with the metadata.
Return
The primary key.
Declaration
array $primaryKey
) : self
{
}
Description
Set the primary key associated with the metadata.
Parameters
The primary key to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the active status of the metadata.
Return
The active status.
Declaration
bool $active
) : self
{
}
Description
Set the active status of the metadata.
Parameters
The active status to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the operation status represented by the waitingFor property.
Return
The operation status.
Declaration
int $waitingFor
) : self
{
}
Description
Set the operation status represented by the waitingFor property.
Parameters
The operation status to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the code representing the waiting status.
Return
The waiting status code.
Declaration
string $waitingForCode
) : self
{
}
Description
Set the code representing the waiting status.
Parameters
The waiting status code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the message associated with the waiting status.
Return
The waiting status message.
Declaration
string $waitingForMessage
) : self
{
}
Description
Set the message associated with the waiting status.
Parameters
The waiting status message to set.
Return
Returns the current instance for method chaining.
Declaration
array $primaryKeyName,
MagicObject $data,
string $waitingForKey,
string $activeKey
) : MetadataDto
{
}
Description
Creates a MetadataDto instance from provided data.
This method constructs a MetadataDto by extracting values from a MagicObject based on specified keys for the primary key, waiting status, and active status.
Parameters
An array of keys to construct the primary key.
The data object from which to extract values.
The key for the waiting status in the data object.
The key for the active status in the data object.
Return
An instance of MetadataDto populated with extracted values.
Declaration
{
}
Description
Get the active status.
Return
True if active, otherwise false.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\MetadataDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) representing metadata information.
The MetadataDto class encapsulates metadata details associated with various data operations.
It includes indicators for active status, a primary key to uniquely identify the metadata, and
a waiting status reflecting the current state of operations.
This class facilitates easy population of its properties from dynamic data sources, particularly
through its static valueOf method.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
Indicates whether the metadata is active.
Declaration
Description
Associated array key value primary key.
Declaration
Description
Represents the status of the operation.
Possible values:
- 1: approval for new data
- 2: updating data
- 3: activate
- 4: deactivate
- 5: delete
- 6: sort order
Methods
Declaration
array $primaryKeyName,
MagicObject $data,
string $waitingForKey,
string $activeKey
) : MetadataDto
{
}
Description
Creates a MetadataDto instance from provided data.
This method constructs a MetadataDto by extracting values from a MagicObject based on specified keys for the primary key, waiting status, and active status.
Parameters
An array of keys to construct the primary key.
The data object from which to extract values.
The key for the waiting status in the data object.
The key for the active status in the data object.
Return
An instance of MetadataDto populated with extracted values.
Declaration
array $primaryKey = null,
bool $active = true,
int $waitingFor = 0
)
{
}
Description
Constructor to initialize properties of the MetadataDto class.
Parameters
An array representing the primary key.
A boolean indicating if the metadata is active.
An integer representing the operation status.
Declaration
{
}
Description
Get the primary key.
Return
The primary key as an array.
Declaration
array $primaryKey
) : self
{
}
Description
Set the primary key.
Parameters
An array representing the primary key.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the waiting status.
Return
The operation status as an integer.
Declaration
int $waitingFor
) : self
{
}
Description
Set the waiting status.
Parameters
An integer representing the new operation status.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the active status.
Return
True if active, otherwise false.
Declaration
bool $active
) : self
{
}
Description
Set the active status.
Parameters
A boolean indicating if the metadata should be active.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\NameValueDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Represents a key-value pair with a name and associated value.
The NameValueDto class is used to store a name and its corresponding value.
This can be useful for handling pairs of data, such as in API responses, form submissions,
or any context where a name and its associated value are required.
Constants
Properties
Declaration
Description
The name associated with the value.
Declaration
Description
The value associated with the name.
Methods
Declaration
string $name,
mixed $value
)
{
}
Description
Constructor to initialize the NameValueDto object.
Parameters
The name to be associated with the value.
The value to be associated with the name.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\OptionDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class OptionDto
Represents an individual option within a form element such as a dropdown, select input, or any other selection component. This class stores the metadata for each option, including the text displayed to the user, the value associated with the option, whether the option is selected by default, the group to which the option belongs, and any additional HTML attributes that can be applied to the option element.
This class is particularly useful for dynamically generating form controls that require configurable options with custom attributes, such as dropdown menus, radio buttons, or checkboxes.
Constants
Properties
Declaration
Description
The text displayed for the option. This is typically the label that the user will see in the UI. For example, "Yes", "No", "Option 1", or "Select Country".
Declaration
Description
The value associated with the option. This value is typically sent as part of the form data when the user selects this option. It could represent an ID, code, or any other identifier related to the option.
Declaration
Description
The group name to which the option belongs. This could be used to categorize or group options. For example, grouping options for a specific category like 'Countries' or 'Product Types'.
Declaration
Description
Indicates whether the option is selected by default. If set to true, the option will be
pre-selected when the form is rendered. If set to false, the option will not be selected by default.
Declaration
Description
An associative array of HTML attributes for the option element. This allows for customization
of the appearance or behavior of the option in the rendered HTML, such as adding a disabled
or data-* attribute.
Methods
Declaration
string $text = '',
string $value = '',
bool $selected = false,
string|null $group = null,
array $attribute = array ( )
)
{
}
Description
Constructor for the OptionDto class.
Initializes the text, value, selected, group, and attribute properties. By default,
the selected flag is set to false, and attribute is an empty array.
Parameters
The text to display for the option (e.g., "Yes", "No").
The value to associate with the option (e.g., "1", "0").
Whether the option is selected by default. Defaults to false.
The group name to which this option belongs (e.g., 'Countries', 'Payment Methods'). Defaults to null.
Additional HTML attributes for the option element (e.g., disabled, data-*).
Declaration
{
}
Description
Gets the text to display for the option.
Return
The option text.
Declaration
string $text
) : self
{
}
Description
Sets the text to display for the option.
Parameters
The option text to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the value associated with the option.
Return
The option value.
Declaration
string $value
) : self
{
}
Description
Sets the value associated with the option.
Parameters
The option value to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets whether the option is selected by default.
Return
true if the option is selected by default, otherwise false.
Declaration
bool $selected
) : self
{
}
Description
Sets whether the option should be selected by default.
Parameters
Whether the option is selected by default.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the group to which this option belongs.
Return
The group name of the option.
Declaration
string $group
) : self
{
}
Description
Sets the group to which this option belongs.
Parameters
The group name to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the array of HTML attributes for the option element.
Return
The option's HTML attributes (e.g., disabled, data-*).
Declaration
array $attribute
) : self
{
}
Description
Sets the array of HTML attributes for the option element.
Parameters
The attributes to set.
Return
Returns the current instance for chaining.
Declaration
array $attribute
) : self
{
}
Description
Adds an individual HTML attribute to the option element.
Parameters
An associative array of attribute key-value pairs to add.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\PageDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class PageDto
Represents an object that handles pagination details, including the page number,
page size, and the data offset. This class is useful for managing pagination in
collections of data. It can be initialized with various pagination-related objects
such as PicoPageable, PicoPage, or another PageDto, or with an array containing
the page number and page size.
Constants
Properties
Declaration
Description
The current page number, start from 1
Declaration
Description
The page size, i.e., the number of items displayed per page
Declaration
Description
The data offset, which is used to calculate the starting position of data on the current page.
Methods
Declaration
PicoPageable|PicoPage|PageDto|array|null $page = null
)
{
}
Description
Constructor for the PageDto class.
This constructor initializes the pagination details (page number, page size, and data offset). It can accept various types of input, including:
PicoPageableobject: A paginated object that provides the current page and page size.PicoPageobject: A simpler object that holds pagination information.PageDtoobject: An existingPageDtoto copy pagination data from.-
array: An array where the first element is the page number and the second element is the page size.If no parameter is provided, the pagination defaults to page 1 with a page size of 10.
Parameters
An optional object or array that provides pagination
Declaration
{
}
Description
Gets the current page number.
Return
The current page number.
Declaration
int $pageNumber
) : self
{
}
Description
Sets the current page number.
Parameters
The page number to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the page size (the number of items per page).
Return
The page size.
Declaration
int $pageSize
) : self
{
}
Description
Sets the page size.
Parameters
The page size to set.
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the data offset (the starting position of data on the current page).
Return
The data offset.
Declaration
int $dataOffset
) : self
{
}
Description
Sets the data offset.
Parameters
The data offset to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\PrimaryKeyValueDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Represents a key-value pair with a name and associated value.
The PrimaryKeyValueDto class is used to store a name and its corresponding value.
This can be useful for handling pairs of data, such as in API responses, form submissions,
or any context where a name and its associated value are required.
Constants
Properties
Declaration
Description
The name associated with the value.
Declaration
Description
The value associated with the name.
Methods
Declaration
string $name,
mixed $value
)
{
}
Description
Constructor to initialize the PrimaryKeyValueDto object.
Parameters
The name to be associated with the value.
The value to be associated with the name.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ResponseCode
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ResponseCode
This class represents the structure for a response code and its associated message. It encapsulates the response code that indicates the status of a request, along with a message that provides additional context about the response.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Methods
Declaration
string $responseCode = '',
string $responseMessage = ''
)
{
}
Description
Constructor for initializing a ResponseCode instance.
Parameters
The response code.
The response message.
Declaration
{
}
Description
Get the response code.
Return
The response code.
Declaration
string $responseCode
) : self
{
}
Description
Set the response code.
Parameters
The response code.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message.
Return
The response message.
Declaration
string $responseMessage
) : self
{
}
Description
Set the response message.
Parameters
The response message.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ResponseDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class ResponseDto
Represents a data transfer object for API responses. This class holds the response code, message, and associated data.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The data associated with the response.
Methods
Declaration
string|null $responseCode = null,
string|null $responseMessage = null,
mixed $data = null
)
{
}
Description
Constructor to initialize properties.
Parameters
The response code.
The response message.
The associated data.
Declaration
MetadataDto $metadata
) : self
{
}
Description
Set the metadata for the data object and return the current instance for method chaining.
This method delegates the setting of metadata to the data object's setMetadata method.
Parameters
The metadata to associate with the data object.
Return
Returns the current instance for method chaining. The current instance for method chaining.
Declaration
{
}
Description
Get the response code.
Return
Declaration
string|null $responseCode
) : self
{
}
Description
Set the response code.
Parameters
The response code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message.
Return
Declaration
string|null $responseMessage
) : self
{
}
Description
Set the response message.
Parameters
The response message to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the associated data.
Return
Declaration
mixed $data
) : self
{
}
Description
Set the associated data.
Parameters
The data to set.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\RowDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) representing a row of data with associated metadata.
The RowDto class encapsulates a single row of data within a dataset, along with its corresponding metadata. This class is designed to hold both the data object, which can be dynamically structured through the MagicObject class, and the metadata that provides additional context about the row's status and attributes.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
Data associated with the row.
Declaration
Description
Metadata associated with the row.
Methods
Declaration
MagicObject $data,
MetadataDto $metadata
)
{
}
Description
Constructor to initialize properties of the RowDto class.
Parameters
The data object for the row.
The metadata associated with the data object.
Declaration
{
}
Description
Get the data object.
Return
The data object associated with the row.
Declaration
MagicObject $data
) : self
{
}
Description
Set the data object and return the current instance for method chaining.
Parameters
The new data object.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the metadata object.
Return
The metadata object associated with the row.
Declaration
MetadataDto $metadata
) : self
{
}
Description
Set the metadata object and return the current instance for method chaining.
Parameters
The new metadata object.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\SelectOptionDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class SelectOptionDto
Represents an individual option within a select input element in a form. This class holds
metadata related to a selection option, including the source from which the option is derived,
its group (if it's part of a grouped set of options), the field it corresponds to in the data model,
and the actual OptionDto that contains the option's display text, value, and other properties.
The SelectOptionDto is commonly used to handle structured options that come from a dynamic
data source, such as an API or database, allowing for proper grouping, categorization, and
representation of the option in a form element.
Constants
Properties
Declaration
Description
The source from which the option is derived. This could represent a data source, such as an API or a database query, that provides the available options for selection.
Examples of source values could be "API", "Database", or a specific data path.
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The field that this option corresponds to. This could be the name of the property or column in the underlying data model that the option represents.
For instance, if the option represents a country, the field could be "country_id".
Declaration
Description
The OptionDto object that contains the actual option's text, value, and attributes.
This defines a single selection option, which typically includes properties like the
option's display text and value.
Methods
Declaration
string $source = '',
string $namespace = '',
string $field = '',
OptionDto $option = null
)
{
}
Description
Constructor for the SelectOptionDto class.
Initializes the source, group, field, and option properties. If no OptionDto
is provided, an empty OptionDto will be created to initialize the option.
Parameters
The source from which the option is derived (e.g., API, Database).
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
The field associated with this option (e.g., country_id, product_id).
An instance of OptionDto that defines the option's metadata.
Declaration
{
}
Description
Gets the source from which the option is derived.
Return
The source of the option (e.g., API, Database).
Declaration
string $source
) : self
{
}
Description
Sets the source from which the option is derived.
Parameters
The source to set (e.g., API, Database).
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Gets the field that this option corresponds to.
Return
The field name of the option (e.g., country_id, product_id).
Declaration
string $field
) : self
{
}
Description
Sets the field that this option corresponds to.
Parameters
The field name to set (e.g., country_id, product_id).
Return
Returns the current instance for chaining.
Declaration
{
}
Description
Gets the OptionDto object that defines the option's metadata (text, value, etc.).
Return
The option's metadata (e.g., text, value, selected state).
Declaration
OptionDto $option
) : self
{
}
Description
Sets the OptionDto object that defines the option's metadata.
Parameters
The option metadata to set.
Return
Returns the current instance for chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\StandardClass
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
StandardClass extends the base stdClass and customizes the __toString method.
This class provides a custom string representation of the object,
converting it into a JSON format that can be optionally pretty-printed
depending on the prettify property.
Properties
Declaration
Description
@var bool Determines if the JSON output should be pretty-printed.
Methods
Declaration
{
}
Description
Converts the object to a string in JSON format.
This method overrides the default __toString method to return a JSON
representation of the object. If the prettify property is set to true,
the JSON will be pretty-printed. Otherwise, it will be compact.
Return
The JSON-encoded string representation of the object.
Declaration
bool $prettify
) : self
{
}
Description
Set the value of the prettify property.
This method controls whether the JSON output will be formatted with pretty-printing or be in compact form.
Parameters
Set to true to enable pretty-printing, false to disable.
Return
Returns the current object instance for method chaining.
MagicApp\AppDto\ResponseDto\ToString
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Base class that provides a __toString method for derived classes.
This class allows converting objects into a string representation (typically JSON), with customizable property naming strategies (e.g., snake_case, camelCase).
It is designed to be extended by other Data Transfer Object (DTO) classes to provide consistent string output across the application.
Features:
- Retrieves properties of the current instance, applying specified naming strategies (e.g., snake_case, camelCase).
- Correctly formats nested objects and arrays according to the naming conventions.
- Uses reflection to read class annotations for dynamic property naming strategy.
-
Implements the
__toStringmethod to output a JSON representation of the object.Supported Naming Strategies:
SNAKE_CASE: Converts property names to snake_case (e.g.,myPropertybecomesmy_property).KEBAB_CASE: Converts property names to kebab-case (e.g.,myPropertybecomesmy-property).TITLE_CASE: Converts property names to Title Case (e.g.,myPropertybecomesMy Property).CAMEL_CASE: The default naming convention (e.g.,my_propertybecomesmyProperty).PASCAL_CASE: Converts property names to PascalCase (e.g.,myPropertybecomesMyProperty).CONSTANT_CASE: Converts property names to CONSTANT_CASE (e.g.,myPropertybecomesMY_PROPERTY).FLAT_CASE: Converts property names to lowercase without any delimiters (e.g.,myPropertybecomesmyproperty).DOT_NOTATION: Converts property names to dot notation (e.g.,myPropertybecomesmy.property).TRAIN_CASE: Converts property names to TRAIN-CASE (e.g.,myPropertybecomesMY-PROPERTY).
Constants
Properties
Declaration
Description
Check if $propertyNamingStrategy and $prettify are set
Declaration
Description
Undocumented variable
Declaration
Description
Undocumented variable
Methods
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\UpdateForm
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class UpdateForm
Represents the response structure for a list-based form in a UI. This class holds metadata
about the module that the form is associated with, such as the module's ID, name, and title,
as well as the status of the request (via the response code and message). It also contains
the main data structure (UpdateFormData) that holds the filter and data controls for the list.
The UpdateForm class is used to encapsulate all necessary information for rendering a form
that interacts with a list of data. It provides details about the module's context and
feedback about the request, as well as the controls and data required for filtering and
displaying the list content in the UI.
Key Features:
- Hold the metadata about the module (ID, name, and title).
- Provide the response status and message for request feedback.
- Contain the
UpdateFormDatastructure, which manages the list's filter and data controls. - Allow easy access to the response details and the data form structure.
Constants
Properties
Declaration
Description
The namespace where the module is located, such as "/", "/admin", "/supervisor", etc.
Declaration
Description
The ID of the module associated with the data.
Declaration
Description
The name of the module associated with the data.
Declaration
Description
The title of the module associated with the data.
Declaration
Description
The response code indicating the status of the request.
Declaration
Description
A message providing additional information about the response.
Declaration
Description
The main data structure containing the list form.
Methods
Declaration
{
}
Description
Get the namespace where the module is located.
Return
The namespace.
Declaration
string $namespace
) : self
{
}
Description
Set the namespace where the module is located.
Parameters
The namespace to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module ID associated with the data.
Return
The module ID.
Declaration
string $moduleId
) : self
{
}
Description
Set the module ID associated with the data.
Parameters
The module ID to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module name associated with the data.
Return
The module name.
Declaration
string $moduleName
) : self
{
}
Description
Set the module name associated with the data.
Parameters
The module name to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the module title associated with the data.
Return
The module title.
Declaration
string $moduleTitle
) : self
{
}
Description
Set the module title associated with the data.
Parameters
The module title to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response code indicating the status of the request.
Return
The response code.
Declaration
string|null $responseCode
) : self
{
}
Description
Set the response code indicating the status of the request.
Parameters
The response code to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the response message providing additional information about the response.
Return
The response message.
Declaration
string|null $responseMessage
) : self
{
}
Description
Set the response message providing additional information about the response.
Parameters
The response message to set.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the main data structure containing the list form.
Return
The data structure for the form.
Declaration
UpdateFormData|null $data
) : self
{
}
Description
Set the main data structure containing the list form.
Parameters
The data structure to set.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\UpdateFormData
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Class UpdateFormData
Represents the data structure for updating form filters or input fields in the UI. This class defines the configuration for a form element intended to update data in the backend. It includes properties related to form inputs, such as the columns or input fields that are displayed in the form for the user to interact with.
In this class, the column property holds an array of InputFormData objects, which represent
the individual fields in the update form.
Properties:
column: An array ofInputFormDataobjects, each representing a column or input field in the form.button: An array ofButtonFormDataobjects, representing buttons in the form (optional).
Constants
Properties
Declaration
Description
The columns or input fields associated with the update form.
This property holds an array of InputFormData objects, each representing a column
or input field used in updating data.
Declaration
Description
The buttons associated with the update form.
This property holds an array of ButtonFormData objects, each representing a button within the form.
Buttons are typically used for submitting the form or triggering specific actions.
Methods
Declaration
{
}
Description
UpdateFormData constructor.
Initializes the column property as an empty array.
Initializes the button property as an empty array.
Declaration
{
}
Description
Gets the array of InputFormData objects representing the columns or input fields.
This method retrieves the form columns (input fields) that the user will interact with.
Return
The array of InputFormData objects.
Declaration
InputFormData[] $column
) : self
{
}
Description
Sets the array of InputFormData objects representing the columns or input fields.
This method sets the column property to a new array of InputFormData objects.
It allows the entire array of columns to be updated at once.
Parameters
The array of InputFormData objects to set.
Return
Returns the current instance for method chaining.
Declaration
InputFormData $inputFormData
) : self
{
}
Description
Adds a single InputFormData object to the column array.
This method appends a single InputFormData object to the column property, which is an array.
Parameters
The InputFormData object to add to the column array.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Gets the array of ButtonFormData objects associated with the form.
This method retrieves the array of ButtonFormData objects that represent the buttons
in the form, such as "Submit" or "Reset" buttons.
Return
The array of ButtonFormData objects.
Declaration
ButtonFormData[] $button
) : self
{
}
Description
Sets the array of ButtonFormData objects representing the buttons in the form.
This method sets the button property to an array of ButtonFormData objects. It allows
you to update the buttons in the form.
Parameters
The array of ButtonFormData objects to set.
Return
Returns the current instance for method chaining.
Declaration
ButtonFormData $buttonFormData
) : self
{
}
Description
Adds a single ButtonFormData object to the button array.
This method appends a single ButtonFormData object to the button property.
Parameters
The ButtonFormData object to add to the button array.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\AppDto\ResponseDto\ValueDto
Declaration
Package
MagicApp\AppDto\ResponseDtoAuthors
- Kamshory
Links
Description
Data Transfer Object (DTO) representing a value with display and raw data.
The ValueDto class is designed to encapsulate a piece of data that consists of a displayable representation and its underlying raw value. This class is particularly useful in scenarios where data needs to be presented in a user-friendly format while retaining access to the original, unprocessed data.
The class extends the ToString base class, enabling string representation based on the specified property naming strategy.
Constants
Properties
Declaration
Description
Data to be displayed.
Declaration
Description
Raw data.
Methods
Declaration
mixed $display = null,
mixed|null $raw = null
)
{
}
Description
Constructor to initialize properties of the ValueDto class.
If the raw data is not provided, it defaults to the display data.
Parameters
The data to be displayed.
The raw data.
Declaration
{
}
Description
Get the data to be displayed.
Return
The data to be displayed.
Declaration
mixed $display
) : self
{
}
Description
Set the data to be displayed and return the current instance for method chaining.
Parameters
The data to set for display.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the raw data.
Return
The raw data.
Declaration
mixed $raw
) : self
{
}
Description
Set the raw data and return the current instance for method chaining.
Parameters
The raw data to set.
Return
Returns the current instance for method chaining.
Declaration
string|null $namingStrategy = null,
bool $prettify = false
) : StandardClass
{
}
Description
Retrieves and formats the properties of the current instance according to the specified naming strategy.
This method extracts all properties of the current object, applies the given naming strategy
(such as camelCase or snake_case), and processes nested objects or arrays recursively.
The result is returned as an instance of StandardClass, with private properties excluded from
the output.
If no naming strategy is provided, the strategy is derived from class annotations, if available, or defaults to the naming convention of the class.
The method also supports pretty-printing of the output if the prettify flag is set to true.
Nested objects and arrays will have their properties or keys recursively formatted with the
specified naming strategy.
Private properties from the current class are excluded from the formatted result, but public and protected properties will be included, even if they are inherited.
Parameters
The naming strategy to apply when formatting property names.
Whether to pretty-print the resulting JSON output. Default is false.
Return
An object containing the formatted property values with the specified naming strategy.
Declaration
array $value,
string $namingStrategy
) : array
{
}
Description
Process an array of values, applying the naming strategy to each key and value.
Parameters
The array to process.
The naming strategy to apply.
Return
The processed array with formatted keys and values.
Declaration
string $name,
string $format
) : string
{
}
Description
Converts the property name to the desired format based on the specified naming convention.
The supported naming conventions are:
- SNAKE_CASE
- KEBAB_CASE
- TITLE_CASE
- CAMEL_CASE (default)
- PASCAL_CASE
- CONSTANT_CASE
- FLAT_CASE
- DOT_NOTATION
- TRAIN_CASE
Parameters
The original property name.
The desired naming format.
Return
The converted property name.
Declaration
string $className
) : self
{
}
Description
Parses the annotations in the class doc comment to retrieve the property-naming-strategy
and prettify values and sets them to the current instance.
This method uses the PicoAnnotationParser to extract and parse the @JSON annotation
from the class doc comment. It retrieves the property-naming-strategy and prettify
values and stores them in the instance for later use.
Parameters
The fully qualified name of the class to inspect.
Return
Returns the current instance for method chaining.
Declaration
string $className
) : string|null
{
}
Description
Retrieves the property-naming-strategy value from the class annotations.
This method checks if the property-naming-strategy annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the property-naming-strategy value, which determines how property names
should be formatted (e.g., camelCase, snake_case).
Parameters
The fully qualified name of the class to inspect.
Return
The value of the property-naming-strategy annotation or null if not found.
Declaration
string $className
) : bool
{
}
Description
Retrieves the prettify value from the class annotations.
This method checks if the prettify annotation has been parsed already.
If not, it calls parseAnnotation() to parse and set the required values. Once set,
it returns the prettify value, which determines if the output should be formatted
as pretty (i.e., indented) JSON.
Parameters
The fully qualified name of the class to inspect.
Return
Returns true if the prettify annotation is set to "true", false otherwise.
Declaration
{
}
Description
Converts the instance to a JSON string representation based on class annotations.
This method uses the propertyValue() method to format the properties of the object
and returns a JSON string. If the prettify annotation is set to true,
the output will be prettified (formatted with indentation).
Return
A JSON string representation of the instance.
MagicApp\Config\ConfigEncrypter
Declaration
Description
Class ConfigEncrypter
This class is responsible for encrypting and decrypting configuration files. It utilizes secret management for various configuration components such as database, mailer, session, and Redis. The class requires a callback function for password handling during the encryption and decryption processes.
Properties
Declaration
Description
Callback password
Methods
Declaration
callable $callbaskPassword
)
{
}
Description
Constructor
Initializes the ConfigEncrypter with a callback function for password handling.
Parameters
Callback function to retrieve password.
Throws
if the callback is not callable.
Declaration
string $inputPath,
string $outputPath
) : boolean
{
}
Description
Encrypt configuration
Loads a configuration from a YAML file, encrypts its sensitive components, and writes the encrypted configuration to a specified output path.
Parameters
Input configuration path.
Output configuration path.
Return
True on success, false on failure.
Declaration
string $inputPath,
string $outputPath
) : boolean
{
}
Description
Decrypt configuration
Loads an encrypted configuration from a YAML file, decrypts its components, and writes the decrypted configuration to a specified output path.
Parameters
Input configuration path.
Output configuration path.
Return
True on success, false on failure.
MagicApp\Config\SecretDatabaseReader
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretDatabaseReader
This class is responsible for reading and decrypting the configuration details
for a database connection. The class extends the SecretObject class and
retrieves sensitive database configuration values (such as database driver,
file, host, port, username, password, etc.) from an encrypted source.
The properties of this class represent various database connection settings,
and are marked with the @DecryptOut annotation to signify that these values
should be decrypted when accessed. This class is designed to be used for
managing sensitive database connection details securely.
Constants
Properties
Declaration
Description
Database server driver
Declaration
Description
Database file path (for SQLite)
Declaration
Description
Database server host
Declaration
Description
Database port
Declaration
Description
Database username
Declaration
Description
Database user password
Declaration
Description
Database name
Declaration
Description
Database schema
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretDatabaseWriter
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretDatabaseWriter
This class is responsible for encrypting and writing the configuration details
for a database connection. The class extends the SecretObject class and
manages sensitive database configuration values (such as database driver,
file, host, port, username, password, etc.) before they are stored or transmitted
in an encrypted format.
The properties of this class represent various database connection settings,
and are marked with the @EncryptIn annotation to signify that these values
should be encrypted before being saved or used. This class is intended for
securely managing database connection details, ensuring that sensitive data
is not stored in plaintext.
Constants
Properties
Declaration
Description
Database server driver
Declaration
Description
Database file path (for SQLite)
Declaration
Description
Database server host
Declaration
Description
Database port
Declaration
Description
Database username
Declaration
Description
Database user password
Declaration
Description
Database name
Declaration
Description
Database schema
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretMailerReader
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretMailerReader
This class is responsible for reading and decrypting sensitive email
configuration details such as SMTP server settings, sender's credentials,
and other related configurations. The class extends the SecretObject
class, which handles the decryption of sensitive data.
The properties in this class are used to store the necessary configuration
values for sending emails via an SMTP server. These properties are marked
with the @DecryptOut annotation to indicate that the values should be
decrypted when read. This class is intended to securely manage mailer
credentials and configuration settings.
Constants
Properties
Declaration
Description
SMTP host
Declaration
Description
SMTP port
Declaration
Description
Sender username
Declaration
Description
Sender password
Declaration
Description
Sender mail address
Declaration
Description
Sender name
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretMailerWriter
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretMailerWriter
This class is responsible for encrypting and storing sensitive email
configuration details such as SMTP server settings, sender's credentials,
and other related configurations. The class extends the SecretObject
class, which handles the encryption of sensitive data before storing them.
The properties in this class store the necessary configuration values for
sending emails via an SMTP server. These properties are marked with the
@EncryptIn annotation, which indicates that the values should be encrypted
before being stored. This class is intended to securely manage and encrypt
mailer credentials and configuration settings.
Constants
Properties
Declaration
Description
SMTP host
Declaration
Description
SMTP port
Declaration
Description
Sender username
Declaration
Description
Sender password
Declaration
Description
Sender mail address
Declaration
Description
Sender name
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretRedisReader
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretRedisReader
This class is responsible for reading and decrypting sensitive Redis
configuration details, such as server connection parameters. The class
extends the SecretObject class, which ensures that sensitive data
is decrypted securely when accessed.
The properties in this class are encrypted, and the @DecryptOut annotation
is used to indicate that the values should be decrypted when read from storage
(e.g., a database or configuration file).
This class provides secure access to Redis connection settings such as host, port, and password. It is designed to be used in applications that require secure management of Redis configuration parameters.
Constants
Properties
Declaration
Description
Redis server host
Declaration
Description
Redis port
Declaration
Description
Redis password
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretRedisWriter
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretRedisWriter
This class is responsible for securely handling and encrypting Redis
configuration details such as the server connection parameters. It extends
the SecretObject class, which ensures that sensitive data is encrypted
when being stored or written to persistent storage (e.g., a database or file system).
The properties in this class are encrypted using the @EncryptIn annotation
to ensure that the sensitive data is encrypted before being stored.
This class provides secure access to Redis connection settings such as host, port, and password, and is designed to be used in applications that require the encryption of Redis configuration parameters before they are stored.
Constants
Properties
Declaration
Description
Redis server host
Declaration
Description
Redis port
Declaration
Description
Redis password
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretSessionReader
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretSessionReader
This class is responsible for securely handling and decrypting session
configuration details such as session save handler and save path. It extends
the SecretObject class, which ensures that sensitive data is decrypted
when being read from persistent storage (e.g., a database or configuration file).
The properties in this class are decrypted using the @DecryptOut annotation
to ensure that the sensitive data is decrypted when accessed.
This class provides secure access to session configuration settings such as the session save handler and path, and is designed to be used in applications that require the decryption of session-related configuration parameters.
Constants
Properties
Declaration
Description
Session save handler
Declaration
Description
Session save path
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Config\SecretSessionWriter
Declaration
Package
MagicApp\ConfigAuthors
- Kamshory
Links
Description
Class SecretSessionWriter
This class is responsible for securely handling and encrypting session
configuration details such as the session save handler and save path. It extends
the SecretObject class, which ensures that sensitive data is encrypted before
being written to persistent storage (e.g., a database or configuration file).
The properties in this class are encrypted using the @EncryptIn annotation
to ensure that sensitive data is securely stored when being written.
This class provides secure access to session configuration settings, and is designed to be used in applications that require encryption of session-related configuration parameters before they are saved.
Constants
Properties
Declaration
Description
Session save handler
Declaration
Description
Session save path
Declaration
Description
Class parameters.
The property name starts with an underscore to prevent child classes from overriding its value.
Declaration
Description
NULL properties.
The property name starts with an underscore to prevent child classes from overriding its value.
Methods
Declaration
self|array|object|null $data = null,
callable|null $secureCallback = null
)
{
}
Description
Constructor for initializing the object with data.
This constructor accepts initial data in various formats (array or object) and allows the optional specification of a callback function for secure key generation. The data is processed and loaded into the object upon instantiation.
Parameters
The initial data for the object. Can be an
An optional callback function for generating
Declaration
{
}
Description
Analyzes the class's parameters and properties to determine which should be encrypted or decrypted based on annotations.
This method uses reflection to retrieve the class's parameters and properties. It then parses annotations associated with these members to identify which properties should undergo encryption or decryption during specific stages (before storage or before retrieval). The appropriate lists of properties are populated accordingly.
Return
Throws
If the annotations are invalid or cannot be parsed.
Declaration
{
}
Description
Generates a secure key for encryption and decryption.
This method checks for a user-defined secure key generation function. If a valid function is provided, it calls that function to generate the key. Otherwise, it returns a concatenation of predefined random keys.
Return
The secure key for encryption/decryption.
Declaration
string $method,
array $params
) : mixed|null
{
}
Description
Magic method called when invoking undefined methods.
This method handles dynamic method calls for property management.
Supported methods:
-
isset<PropertyName>: Checks if the property is set.- Example:
$obj->issetFoo()returns true if propertyfoois set.
- Example:
-
is<PropertyName>: Checks if the property is set and equals 1 (truthy).- Example:
$obj->isFoo()returns true if propertyfoois set and is equal to 1.
- Example:
-
get<PropertyName>: Retrieves the value of the property.- Example:
$value = $obj->getFoo()gets the value of propertyfoo.
- Example:
-
set<PropertyName>: Sets the value of the property.- Example:
$obj->setFoo($value)sets the propertyfooto$value.
- Example:
-
unset<PropertyName>: Unsets the property.- Example:
$obj->unsetFoo()removes the propertyfoo.
- Example:
-
push<PropertyName>: Pushes a value onto an array property.- Example:
$obj->pushFoo($value)adds$valueto the array propertyfoo.
- Example:
-
pop<PropertyName>: Pops a value from an array property.- Example:
$value = $obj->popFoo()removes and returns the last value from the array propertyfoo.
- Example:
Parameters
Method name.
Parameters for the method.
Return
The result of the method call or null if not applicable.
Declaration
string $var,
mixed $value
) : self
{
}
Description
Set a value for the specified property.
This method sets the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
The value to set.
Return
Declaration
string $var
) : mixed
{
}
Description
Get the value of the specified property.
This method retrieves the value of a property and applies encryption or decryption if necessary based on the defined property rules.
Parameters
The name of the property.
Return
The value of the property.
Declaration
string $var
) : mixed
{
}
Description
Get the raw value of the specified property.
This method retrieves the raw value of a property without any encryption or decryption.
Parameters
The name of the property.
Return
The raw value of the property, or null if not set.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of MagicObject or PicoGenericObject.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
mixed $data
) : bool
{
}
Description
Check if the given data is an instance of self or stdClass.
Parameters
The data to check.
Return
True if the data is an instance, otherwise false.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string|number $data,
string|null $hexKey = null
) : mixed
{
}
Description
Encrypt data recursively.
This method encrypts the provided data, which can be an object, array, or scalar value. It handles nested structures by encrypting each value individually.
Parameters
The data to encrypt.
The encryption key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted data.
Declaration
string $plaintext,
string|null $hexKey = null
) : string
{
}
Description
Encrypt a string.
This method encrypts a plain text string using a specified or generated secure key.
Parameters
The plain text to be encrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The encrypted string in base64 format.
Declaration
MagicObject|PicoGenericObject|self|array|stdClass|string $data,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt data recursively.
This method decrypts the provided ciphertext, which can be an object, array, or scalar value. It handles nested structures by decrypting each value individually.
Parameters
The ciphertext to decrypt.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $ciphertext,
string|null $hexKey = null
) : string|null
{
}
Description
Decrypt a string.
This method decrypts a given ciphertext string using a specified or generated secure key.
Parameters
The encrypted data to be decrypted.
The key in hexadecimal format. If null, a secure key will be generated.
Return
The decrypted string or null if decryption fails.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption after being read.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires encryption after being read.
Parameters
The variable name.
Return
True if the value needs to be encrypted, otherwise false.
Declaration
string $var
) : bool
{
}
Description
Check if a value requires decryption before being stored.
Parameters
The variable name.
Return
True if the value needs to be decrypted, otherwise false.
Declaration
mixed $data
) : self
{
}
Description
Load data into the object.
This method populates the object's properties from the provided data, which can be an object, array, or scalar value.
Parameters
The data to load.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
This method parses an INI formatted string and loads the data into the object.
Parameters
The raw INI data as a string.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
This method reads an INI file and loads the data into the object.
Parameters
The path to the INI file.
Flag to indicate whether to use environment variable replacement.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
This method parses a YAML formatted string and loads the data into the object.
Parameters
The YAML data as a string.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
This method reads a YAML file and loads the data into the object.
Parameters
The path to the YAML file.
Flag to indicate whether to replace environment variables.
Flag to indicate whether to return results as an object.
Flag to indicate whether to convert nested objects to MagicObject.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
This method parses a JSON formatted string and loads the data into the object.
Parameters
The JSON data as a string.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON file.
This method reads a JSON file and loads the data into the object.
Parameters
The path to the JSON file.
Flag to indicate whether to replace environment variables.
Flag to create recursive object.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the object to read-only mode.
When in read-only mode, setters will not change the value of the object's properties, but the loadData method will still work.
Parameters
Flag to set the object to read-only.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue
) : self
{
}
Description
Set a property value.
Parameters
The name of the property to set.
The value to set for the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Add an element to a property array.
Parameters
The name of the property.
The value to add.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Remove the last element from a property array.
Parameters
The name of the property.
Return
The removed value or null if the property is not an array.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get a property value.
Parameters
The name of the property.
Return
The value of the property or null if not set.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed
{
}
Description
Get a property value or return a default value if not set.
Parameters
The name of the property.
The default value to return if the property is not set.
Return
The property value or the default value.
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copies values from another object to the current object based on specified filters.
This method allows selective copying of property values from a source object to the current object. You can specify which properties to copy using a filter, and you can choose whether to include properties with null values.
Parameters
The source object from which to copy values.
An optional array of property names to filter which values
A flag indicating whether to include properties with null
Return
Returns the current instance for method chaining.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value.
This method retrieves the values of the object's properties, optionally converting the property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get object value as an object.
This method is an alias for the value() method, allowing for retrieval of object values, optionally in snake case.
Parameters
Flag to convert property names to snake case.
Return
An object containing the values of the properties.
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get object value as an associative array.
This method retrieves the object values and converts them to an associative array, optionally converting property names to snake case.
Parameters
Flag to convert property names to snake case.
Return
An associative array containing the values of the properties.
Declaration
{
}
Description
Get object value as an associative array with upper camel case keys.
This method retrieves the object values and converts them to an associative array, with keys formatted in upper camel case.
Return
An associative array containing the values of the properties with upper camel case keys.
Declaration
{
}
Description
Check if JSON naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if YAML naming strategy is snake case.
Return
True if the naming strategy is snake case, otherwise false.
Declaration
{
}
Description
Check if JSON naming strategy is upper camel case.
Return
True if the naming strategy is upper camel case, otherwise false.
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
{
}
Description
Check if JSON naming strategy is camel case.
Return
True if the naming strategy is camel case, otherwise false.
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get the list of properties of the class.
This method returns an array of properties defined in the class, optionally reflecting the self class or converting the properties to an array.
Parameters
Flag to include properties defined in the current class.
Flag to return properties as an array.
Return
An array of ReflectionProperty objects or property names.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify null properties.
This method keeps track of properties that have been set to null, allowing for tracking changes to properties.
Parameters
The name of the property.
The value of the property.
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Get the encrypted value of the object.
This method returns an array representation of the object's encrypted values.
Return
An array containing the encrypted values.
Declaration
array $array
) : array
{
}
Description
Encrypt values recursively.
This method encrypts each string value in the provided array. Nested arrays are also processed.
Parameters
The array of values to be encrypted.
Return
The array with encrypted values.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
This method attempts to convert an array into a friendly YAML format.
Parameters
The level where to switch to inline YAML. If set to NULL,
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
Declaration
{
}
Description
Magic method to convert the object to a string.
This method returns a JSON representation of the object.
Return
A JSON representation of the object.
MagicApp\Entity\AppModule
Declaration
Package
MagicApp\EntityAuthors
- Kamshory
Links
Description
Class AppModule
Represents an application module entity. This class is designed to be used as a part of the application's domain model, encapsulating the properties and behaviors related to a module within the app.
The AppModule class extends the MagicObject class, providing additional functionality
such as serialization, deserialization, and possibly encryption/decryption, depending on
the implementation of MagicObject.
This class can be used to represent various modules of an application, such as user management, content management, or other logical units that the application may be divided into.
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\Entity\AppModuleGroup
Declaration
Package
MagicApp\EntityAuthors
- Kamshory
Links
Description
Class AppModuleGroup
Represents a group of application modules. This class serves as a container or organizational unit for managing multiple modules within the application.
The AppModuleGroup class extends the MagicObject class, allowing it to inherit
functionalities such as serialization, deserialization, and possibly encryption/decryption,
depending on the implementation of MagicObject.
This class can be used to logically group related application modules together, allowing for easier management and organization of the application's structure.
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\Entity\AppUser
Declaration
Package
MagicApp\EntityAuthors
- Kamshory
Links
Description
Class AppUser
Represents a user in the application. The AppUser class is part of the MagicApp\Entity
namespace and extends the MagicObject class, inheriting its functionalities such as
serialization, deserialization, and possibly encryption/decryption.
This class can be used to model an individual user within the application, allowing for user-related properties (e.g., username, email, roles) and behaviors (e.g., authentication, authorization) to be encapsulated in a single object.
As the class currently has no properties or methods, it may serve as a basic structure that can be expanded with additional user-related attributes and methods in the future.
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\Entity\AppUserLevel
Declaration
Package
MagicApp\EntityAuthors
- Kamshory
Links
Description
Class AppUserLevel
Represents a user level or role within the application. The AppUserLevel class is part
of the MagicApp\Entity namespace and extends the MagicObject class, inheriting functionalities
such as serialization, deserialization, and potentially encryption/decryption.
The AppUserLevel class is used to define different levels or roles assigned to users within
the application. These roles can determine user permissions, access control, and other
user-specific behavior based on their assigned level.
Although the class currently does not contain any properties or methods, it can be expanded in the future to include attributes such as role names, permissions, descriptions, or any other relevant data tied to user roles.
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\Entity\AppUserRole
Declaration
Package
MagicApp\EntityAuthors
- Kamshory
Links
Description
Class AppUserRole
Represents a user role within the application. The AppUserRole class is part of the MagicApp\Entity
namespace and extends the MagicObject class, which provides core functionalities such as
serialization, deserialization, and possibly encryption/decryption depending on the parent class implementation.
The AppUserRole class is intended to define and manage roles that can be assigned to users within
the application. These roles will typically be used to grant or restrict access to certain resources
or operations based on the assigned role. Roles can correspond to specific sets of permissions or privileges.
While the class does not currently have any properties or methods, it can be extended in the future to include attributes such as role name, description, permissions, and any other relevant data associated with user roles.
Constants
Methods
Declaration
{
}
Description
Retrieves the list of null properties.
Return
The list of properties that are currently null.
Declaration
self|array|stdClass|object|null $data = null,
PicoDatabase|PDO|null $database = null
)
{
}
Description
Constructor.
Initializes the object with the provided data and optionally connects to a database. The constructor can accept different types of data to populate the object and can also accept a PDO connection or a PicoDatabase instance to set up the database connection.
Parameters
Initial data to populate the object. This can be:
A database connection instance, either:
Throws
If the annotations are invalid or cannot be parsed.
Declaration
mixed $data
) : self
{
}
Description
Loads data into the object.
Parameters
Data to load, which can be another MagicObject, an array, or an object.
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI string.
Parameters
Raw INI data
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false
) : self
{
}
Description
Load data from an INI file.
Parameters
File path to the INI file
Flag to indicate whether to use environment variables
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML string.
Parameters
YAML string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a YAML file.
Parameters
File path to the YAML file
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $rawData,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Load data from a JSON string.
Parameters
JSON string
Replace all environment variable values
Result as an object instead of an array
Convert all objects to MagicObject
Return
Returns the current instance for method chaining.
Declaration
string $path,
bool $systemEnv = false,
bool $asObject = false,
bool $recursive = false
) : self
{
}
Description
Loads data from a JSON file and processes it based on the provided options.
Parameters
The file path to the JSON file.
Whether to replace system environment variables in the data (default: false).
Whether to return the result as an object instead of an associative array (default: false).
Whether to recursively convert all objects into MagicObject instances (default: false).
Return
Returns the current instance for method chaining.
Throws
If the specified JSON file does not exist.
Declaration
mixed $data,
bool $asObject,
bool $recursive
) : self
{
}
Description
Loads processed JSON data and optionally converts it to objects or parses recursively.
Parameters
The processed data to load (array or object).
Whether to return the result as an object.
Whether to recursively convert all objects into MagicObject instances.
Return
Returns the current instance for method chaining.
Declaration
bool $readonly
) : self
{
}
Description
Set the read-only state of the object.
When set to read-only, setters will not change the value of its properties, but loadData will still function normally.
Parameters
Flag to set the object as read-only
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Check if database is connected or not
Return
Returns true if the database is connected, false otherwise.
Declaration
PicoDatabase $database
) : self
{
}
Description
Set the database connection.
Parameters
Database connection
Return
Returns the current instance for method chaining.
Declaration
PicoDatabase|null $database = null
) : PicoDatabase|null
{
}
Description
Set or get the current database connection.
If the parameter is not empty, set the current database to the provided value. Otherwise, return the current database or null.
Parameters
Database connection
Return
Declaration
MagicObject|PicoDatabaseEntity|null $databaseEntity = null
) : self|PicoDatabaseEntity
{
}
Description
Set or get the database entity.
If a database entity is provided, it will be set; otherwise, the current database entity will be returned.
Parameters
The database entity to set or null to get the current entity.
Return
Returns the current instance for method chaining, or the current database entity if no parameter is provided.
Declaration
object|array $sourceData,
array $propertyNames
) : object|array
{
}
Description
Remove properties except for the specified ones.
Parameters
Data to filter
Names of properties to retain
Return
Filtered data
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Save the current object to the database.
This method persists the current object to the database. If $includeNull is TRUE,
all properties of the object, including those with null values, will be saved.
If FALSE, only the properties with non-null values will be saved.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If no corresponding record is found.
If a database error occurs.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Generate a query to save data to the database.
This method prepares a query to persist the current object to the database.
If $includeNull is TRUE, properties with null values will be included in the query.
If FALSE, only properties with non-null values will be included.
Parameters
If TRUE, all properties, including null, will be saved.
Return
Returns a PicoDatabaseQueryBuilder object for query construction.
Throws
If there is no active database connection.
If no corresponding record is found.
Declaration
{
}
Description
Select data from the database.
This method retrieves data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Select all data from the database.
This method retrieves all data from the database. If no data is found, a NoRecordFoundException will be thrown.
The retrieved data is then loaded into the current instance for further use.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If no records are found in the database.
If a database error occurs.
Declaration
{
}
Description
Generate a query to select data.
This method prepares a query to select data from the database. The query can then be used to execute the retrieval of data manually if needed.
Return
Returns a PicoDatabaseQueryBuilder object for building the select query.
Throws
If there is no active database connection.
If a database error occurs.
Declaration
{
}
Description
Executes a database query based on the parameters and annotations from the caller function.
This method uses reflection to extract the query string and return type from the caller's docblock, binds the provided parameters, and executes the query against the database.
It analyzes the parameters and return type of the caller function to enable dynamic query execution tailored to the specified return type. Supported return types include:
void: Returns null.intorinteger: Returns the number of affected rows.objectorstdClass: Returns a single result as an object.stdClass[]: Returns all results as an array of stdClass objects.array: Returns all results as an associative array.string: Returns the JSON-encoded results.PDOStatement: Returns the prepared statement for further operations if needed.MagicObjectand its derived classes: If the return type is a class name or an array of class names, instances of that class will be created for each row fetched.MagicObject[]and its derived classes: Instances of the corresponding class will be created for each row fetched.
Return
The result based on the return type of the caller function:
Throws
If there is an error executing the database query.
If there is no query to be executed or if the input is invalid.
If the return type specified in the docblock is invalid or unrecognized.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Insert data into the database.
This method inserts the current objectΓÇÖs data into the database. If $includeNull is TRUE,
properties with null values will also be included in the insert query. If FALSE, only properties with non-null values will be inserted.
Parameters
If TRUE, all properties, including null, will be inserted. If FALSE, only non-null values will be inserted.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the insert query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for inserting data.
This method prepares a query to insert data into the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the query. If FALSE, only non-null properties will be inserted.
Parameters
If TRUE, all properties, including null, will be included in the insert query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the insert query.
Throws
If there is no active database connection.
Declaration
bool $includeNull = false
) : PDOStatement
{
}
Description
Update data in the database.
This method updates the current object's data in the database. If $includeNull is TRUE,
properties with null values will be included in the update query. If FALSE, only properties with non-null values will be updated.
Parameters
If TRUE, all properties, including null, will be updated. If FALSE, only non-null values will be updated.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the update query.
Declaration
bool $includeNull = false
) : PicoDatabaseQueryBuilder
{
}
Description
Get the query for updating data.
This method prepares a query to update data in the database. It can be used to manually execute the query.
If $includeNull is TRUE, properties with null values will be included in the update query. If FALSE, only non-null properties will be updated.
Parameters
If TRUE, all properties, including null, will be included in the update query. If FALSE, only non-null properties will be included.
Return
Returns a PicoDatabaseQueryBuilder object for building the update query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Delete data from the database.
This method deletes data associated with the current object from the database.
Return
Returns a PDOStatement object for further database interaction.
Throws
If there is no active database connection.
If there is an error executing the delete query.
Declaration
{
}
Description
Get the query for deleting data.
This method prepares a query to delete data from the database. It can be used to manually execute the query.
Return
Returns a PicoDatabaseQueryBuilder object for building the delete query.
Throws
If there is no active database connection.
Declaration
{
}
Description
Starts a database transaction.
This method begins a new database transaction. It delegates the actual transaction
initiation to the transactionalCommand method, passing the "start" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error while starting the transaction.
Declaration
{
}
Description
Commits the current database transaction.
This method commits the current transaction. If successful, it makes all database
changes made during the transaction permanent. It delegates to the transactionalCommand method
with the "commit" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the commit process.
Declaration
{
}
Description
Rolls back the current database transaction.
This method rolls back the current transaction, undoing all database changes made
during the transaction. It calls the transactionalCommand method with the "rollback" command.
Return
Returns the current instance for method chaining.
Throws
If there is no active database connection.
If there is an error during the rollback process.
Declaration
PicoSpecification $specification
) : PicoDatabasePersistenceExtended
{
}
Description
Get a MagicObject with a WHERE specification.
This method applies a WHERE condition to the database query using the provided specification.
The specification is an instance of PicoSpecification which defines the filtering criteria.
Parameters
The specification to define the WHERE condition.
Return
Returns an instance of PicoDatabasePersistenceExtended
Throws
If there is no active database connection.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Modify properties with null values.
This method tracks properties that are assigned a null value, storing them in a _nullProperties array.
If a property is set to null, it is added to the _nullProperties array; if it's set to a non-null value, it is removed from the array.
Parameters
The name of the property to check and modify.
The value to be assigned to the property.
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed|null $propertyValue,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Set property value.
Parameters
Property name
Property value
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the end of an array property (alias for push).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property.
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName,
mixed $propertyValue
) : self
{
}
Description
Adds an element to the beginning of an array property (alias for unshift).
Parameters
Property name
Property value
Return
Returns the current instance for method chaining.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the last element of an array property.
This method removes the last element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the last element will be removed.
Return
The last element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed
{
}
Description
Remove and return the first element of an array property.
This method removes the first element from an array property and returns it. If the specified property is not an array or does not exist, null is returned.
Parameters
The name of the property (array) from which the first element will be removed.
Return
The first element of the array, or null if the property is not an array or doesn't exist.
Declaration
string $propertyName
) : mixed|null
{
}
Description
Get the value of a property.
This method retrieves the value of the specified property. If the property does not exist, it returns null.
Parameters
The name of the property to retrieve.
Return
The value of the property, or null if the property is not set.
Declaration
string $propertyName
) : bool
{
}
Description
Check if a property has a value set.
This method checks if the specified property is set (exists and has a value). It returns true if the property exists and has a value, and false otherwise.
Parameters
The name of the property to check.
Return
True if the property is set, false otherwise.
Declaration
string $propertyName,
mixed|null $defaultValue = null
) : mixed|null
{
}
Description
Get the value of a property or a default value if the property is not set.
This method retrieves the value of the specified property. If the property is not set, the provided default value is returned.
Parameters
The name of the property to retrieve.
The default value to return if the property is not set.
Return
The value of the property, or the default value if the property is not set.
Declaration
string $propertyName,
mixed $propertyValue
)
{
}
Description
Set property value (magic setter).
Parameters
Property name
Property value
Declaration
string $propertyName
) : mixed|null
{
}
Description
Magic method to get the value of a property.
This method is automatically called when an undefined or inaccessible property is accessed.
It checks if the property has been set (including null values) using the __isset method and
retrieves its value via the get method if it exists.
Parameters
The name of the property to retrieve.
Return
The value of the property if it is set, or null if the property is not set or accessible.
Declaration
string $propertyName
) : bool
{
}
Description
Magic method to check if a property is set (including null).
This method is automatically called when checking if an undefined or inaccessible property is set
using isset(). It checks if the property exists and is set (even if its value is null).
Parameters
The name of the property to check.
Return
True if the property is set (including null), false otherwise.
Declaration
string $propertyName
) : void
{
}
Description
Magic method to unset a property.
This method is automatically called when a property is unset using unset().
It unsets the specified property from the object.
Parameters
The name of the property to unset.
Return
Declaration
self|mixed $source,
array|null $filter = null,
bool $includeNull = false
) : self
{
}
Description
Copy values from another object to the current instance.
This method copies property values from the provided source object to the current instance. Optionally, a filter can be applied to specify which properties to copy, and whether null values should be included.
Parameters
The source object or data from which values will be copied. If a non-object is provided, this may result in unexpected behavior.
An optional array of property names to filter which properties are copied. If null, all properties are copied.
Flag indicating whether to include properties with null values. If false, properties with null values will be excluded from the copy.
Return
Returns the current instance for method chaining after copying the values.
Declaration
string $propertyName,
bool $skipModifyNullProperties = false
) : self
{
}
Description
Remove property value and set it to null.
Parameters
Property name
Skip modifying null properties
Return
Returns the current instance for method chaining.
Declaration
{
}
Description
Retrieve table information for the current instance.
This method retrieves the table information (e.g., schema, columns) associated with the current object. It lazily loads the table information, meaning it will be fetched only once and cached for future calls to improve performance.
Return
Returns an instance of the PicoTableInfo class containing the table schema and other related metadata.
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get default values for properties
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing default values
Declaration
bool $snakeCase = false
) : stdClass
{
}
Description
Get the object values
Parameters
Flag indicating whether to convert property names to snake case
Return
An object containing the values of the properties
Declaration
boolean|null $snakeCase = null
) : stdClass
{
}
Description
Get the object value as a specified format
Parameters
Flag indicating whether to convert property names to snake case; if null, default behavior is used
Return
An object representing the value of the instance
Declaration
bool $snakeCase = false
) : array
{
}
Description
Get the object value as an associative array
Parameters
Flag indicating whether to convert property names to snake case
Return
An associative array representing the object values
Declaration
{
}
Description
Get the object value as an associative array with the first letter of each key in upper camel case
Return
An associative array with keys in upper camel case
Declaration
{
}
Description
Check if the JSON naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the YAML naming strategy is snake case
Return
True if the naming strategy is snake case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is upper camel case
Return
True if the naming strategy is upper camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON naming strategy is camel case
Return
True if the naming strategy is camel case; otherwise, false
Declaration
{
}
Description
Check if the JSON output should be prettified
Return
True if JSON output is set to be prettified; otherwise, false
Declaration
mixed $params
) : bool
{
}
Description
Checks if the provided parameter is an array.
This function verifies if the given parameter is set and is of type array. It is a helper method used to validate the type of data before performing any operations on it that require an array.
Parameters
The parameter to check.
Return
Returns true if the parameter is set and is an array, otherwise returns false.
Declaration
mixed $value
) : bool
{
}
Description
Check if a value is not null and not empty
Parameters
The value to check
Return
True if the value is not null and not empty; otherwise, false
Declaration
bool $reflectSelf = false,
bool $asArrayProps = false
) : array
{
}
Description
Get a list of properties
Parameters
Flag indicating whether to reflect properties of the current class
Flag indicating whether to return properties as an array
Return
An array of property names or ReflectionProperty objects
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
List all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption = 0,
array|null $result = null
) : int
{
}
Description
Count the data based on specifications
Parameters
The persistence object
The specification for filtering
The pagination information
The sorting criteria
The find option
The result set
Return
The count of matching records
Declaration
PicoSpecification|null $specification = null,
PicoSortable|string|null $sortable = null,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record based on specifications
Parameters
The specification for filtering
The sorting criteria
An optional map of subqueries
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
{
}
Description
Find all records without filters, sorted by primary key in ascending order
Return
The paginated data
Declaration
{
}
Description
Find all records without filters, sorted by primary key in descending order
Return
The paginated data
Declaration
string $selected,
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null,
int $findOption = 0
) : PicoPageData
{
}
Description
Find specific records
Parameters
The selected field(s)
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
The find option
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records.
Declaration
PicoDatabasePersistence $persist,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable,
PicoSortable|string|null $sortable,
int $findOption,
mixed $result
) : int
{
}
Description
Counts the total number of records for a given query with pagination, with special handling for SQLite.
Parameters
The persistence object to interact with the database.
The specification used to filter the results.
Pagination information.
Sorting information.
The find option flag indicating how the query should be executed.
The result set to count.
Return
The total number of matching records considering pagination.
Declaration
PicoSpecification|null $specification = null,
PicoPageable|null $pageable = null,
PicoSortable|null $sortable = null
) : int|false
{
}
Description
Count all records based on specifications
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The count of records or false on error
Throws
if no records are found
if no database connection is established
Declaration
PicoSpecification|null $specification = null,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null
) : PicoDatabaseQueryBuilder
{
}
Description
Build a query to find all records
Parameters
The specification for filtering
The pagination information
The sorting criteria
Return
The query builder
Throws
if no record is found
if no database connection is established
Declaration
mixed $params
) : self
{
}
Description
Find one record by primary key value
Parameters
The parameters for the search
Return
The found instance.
Throws
if no record is found
if no database connection is established
Declaration
array $params
) : self
{
}
Description
Find one record if it exists by primary key value
Parameters
The parameters for the search
Return
The found instance. or the current instance if not found
Declaration
string $method,
mixed $params,
PicoSpecification|null $specification,
PicoPageable|string|null $pageable = null,
PicoSortable|string|null $sortable = null,
bool $passive = false,
array|null $subqueryMap = null
) : PicoPageData
{
}
Description
Find records by specified parameters
Parameters
The method to find by
The parameters for the search
The specification for filtering
The pagination information
The sorting criteria
Flag indicating whether the object is passive
An optional map of subqueries
Return
The paginated data
Throws
if no records are found
if no database connection is established
Declaration
string $method,
mixed $params
) : int
{
}
Description
Count data from the database.
Parameters
The method used for finding.
The parameters to use for the count.
Return
The count of matching records.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : int
{
}
Description
Delete records based on parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
The number of deleted records.
Throws
If there is no database connection.
Declaration
mixed $primaryKeyVal,
array|null $subqueryMap = null
) : self
{
}
Description
Find one record using the primary key value.
Parameters
The primary key value.
Optional subquery map for additional queries.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance.
Throws
If no record is found.
If there is no database connection.
Declaration
string $method,
mixed $params,
PicoSortable|string|null $sortable = null
) : object
{
}
Description
Find one record if it exists based on parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Optional sorting criteria.
Return
The found instance or the current instance if not found.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Delete one record based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the deletion.
Return
True on success; otherwise, false.
Throws
If there is no database connection.
Declaration
string $method,
mixed $params
) : bool
{
}
Description
Check if a record exists based on specified parameters.
Parameters
The method used for finding.
The parameters to use for the search.
Return
True if the record exists; otherwise, false.
Throws
If there is no database connection.
Declaration
string $propertyName,
string[] $params
) : string
{
}
Description
Convert a boolean value to text based on the specified property name.
Parameters
The property name to check.
The text representations for true and false.
Return
The corresponding text representation.
Declaration
array $result,
bool $passive = false
) : array
{
}
Description
Convert the result to an array of objects.
Parameters
The result set to convert.
Flag indicating whether the objects are passive.
Return
An array of objects.
Declaration
{
}
Description
Get the number of properties of the object.
Return
The number of properties.
Declaration
string $method,
mixed $params
) : mixed|null
{
}
Description
Magic method called when a user calls any undefined method. The __call method checks the prefix of the called method and invokes the appropriate method according to its name and parameters.
Method Descriptions:
-
hasValue: Checks if the property has a value.
- Example:
$object->hasValuePropertyName();
- Example:
-
isset: Checks if the property is set.
- Example:
$object->issetPropertyName();
- Example:
-
is: Retrieves the property value as a boolean.
- Example:
$isActive = $object->isActive();
- Example:
-
equals: Checks if the property value equals the given value.
- Example:
$isEqual = $object->equalsPropertyName($value);
- Example:
-
get: Retrieves the property value.
- Example:
$value = $object->getPropertyName();
- Example:
-
set: Sets the property value.
- Example:
$object->setPropertyName($value);
- Example:
-
unset: Unsets the property value.
- Example:
$object->unsetPropertyName();
- Example:
-
push: Adds array elements to a property at the end.
- Example:
$object->pushPropertyName($newElement);
- Example:
-
append: Appends array elements to a property at the end.
- Example:
$object->appendPropertyName($newElement);
- Example:
-
unshift: Adds array elements to a property at the beginning.
- Example:
$object->unshiftPropertyName($newElement);
- Example:
-
prepend: Prepends array elements to a property at the beginning.
- Example:
$object->prependPropertyName($newElement);
- Example:
-
pop: Removes the last element from the property.
- Example:
$removedElement = $object->popPropertyName();
- Example:
-
shift: Removes the first element from the property.
- Example:
$removedElement = $object->shiftPropertyName();
- Example:
-
findOneBy: Searches for data in the database and returns one record.
- Example:
$record = $object->findOneByPropertyName($value); - Requires a database connection.
- Example:
-
findOneIfExistsBy: Searches for data in the database by any column values and returns one record.
- Example:
$record = $object->findOneIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
deleteOneBy: Deletes data from the database by any column values and returns one record.
- Example:
$deletedRecord = $object->deleteOneByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findFirstBy: Searches for data in the database by any column values and returns the first record.
- Example:
$firstRecord = $object->findFirstByColumnName($value); - Requires a database connection.
- Example:
-
findFirstIfExistsBy: Similar to
findFirstBy, but returns the first record if it exists.- Example:
$firstRecord = $object->findFirstIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findLastBy: Searches for data in the database by any column values and returns the last record.
- Example:
$lastRecord = $object->findLastByColumnName($value); - Requires a database connection.
- Example:
-
findLastIfExistsBy: Similar to
findLastBy, but returns the last record if it exists.- Example:
$lastRecord = $object->findLastIfExistsByPropertyName($value, $sortable); - Requires a database connection.
- Example:
-
findBy: Searches for multiple records in the database by any column values.
- Example:
$records = $object->findByColumnName($value); - Requires a database connection.
- Example:
-
countBy: Counts data from the database.
- Example:
$count = $object->countByColumnName();
- Example:
-
existsBy: Checks for data in the database.
- Example:
$exists = $object->existsByColumn($column); - Requires a database connection.
- Example:
-
deleteBy: Deletes data from the database without reading it first.
- Example:
$object->deleteByPropertyName($value); - Requires a database connection.
- Example:
-
booleanToTextBy: Converts a boolean value to "yes/no" or "true/false" based on given parameters.
- Example:
$result = $object->booleanToTextByActive("Yes", "No"); - If $obj->active is true, $result will be "Yes"; otherwise, it will be "No".
- Example:
-
startsWith: Checks if the value starts with a given string.
- Example:
$startsWith = $object->startsWithPropertyName("prefix");
- Example:
-
endsWith: Checks if the value ends with a given string.
- Example:
$endsWith = $object->endsWithPropertyName("suffix");
- Example:
-
label: Retrieves the label associated with the given property.
- If the label is not set, it attempts to fetch it from annotations.
- Example:
$label = $object->labelPropertyName();
-
option: Returns the first parameter if the property is set to
trueor equals1; otherwise returns the second parameter.- Example:
$option = $object->optionPropertyName("Yes", "No");
- Example:
-
notNull: Checks if the specified property is set (not null).
- Example:
$isNotNull = $object->notNullPropertyName();
- Example:
-
notEmpty: Checks if the specified property is set and not empty.
- Example:
$isNotEmpty = $object->notEmptyPropertyName();
- Example:
-
notZero: Checks if the specified property is set and not equal to zero.
- Example:
$isNotZero = $object->notZeroPropertyName();
- Example:
-
notEquals: Checks if the specified property is set and does not equal the given value.
- Example:
$isNotEqual = $object->notEqualsPropertyName($value);
- Example:
Parameters
Method name
Parameters for the method
Return
The result of the called method, or null if not applicable
Declaration
{
}
Description
Magic method to convert the object to a string.
Return
A JSON representation of the object.
Declaration
self $value,
bool $snake
) : mixed
{
}
Description
Recursively stringify an object or array of objects.
Parameters
The object to stringify.
Flag to indicate whether to convert property names to snake_case.
Return
The stringified object or array.
Declaration
int|null $inline = null,
int $indent = 4,
int $flags = 0
) : string
{
}
Description
Dumps a PHP value to a YAML string.
The dump method, when supplied with an array, converts it into a friendly YAML format.
Parameters
The level at which to switch to inline YAML. If NULL, the maximum depth will be used.
The number of spaces to use for indentation of nested nodes.
A bit field of DUMP_* constants to customize the dumped YAML string.
Return
A YAML string representing the original PHP value.
MagicApp\Exceptions\InvalidDownloadException
Declaration
Package
MagicObject\ExceptionsAuthors
- Kamshory
Links
Description
Class InvalidDownloadException
Custom exception for handling errors during download operations. This exception is thrown when there are issues such as network failures, timeouts, or invalid responses during a download process.
Properties
Declaration
Description
Previous exception
Methods
Declaration
string $message,
int $code = 0,
Throwable|null $previous = null
)
{
}
Description
Constructor for InvalidDownloadException.
Parameters
Exception message
Exception code
Previous exception
Declaration
{
}
Description
Get the previous exception.
Return
MagicApp\Menu\AccountMenu
Declaration
Package
MagicApp\MenuAuthors
- Kamshory
Links
Description
Class AccountMenu
Represents the menu structure for the user account section of the application. The AccountMenu class
extends the BasicMenu class and provides functionalities related to rendering and managing a specific
set of navigation options for the user account area, such as profile management, account settings,
and logout options.
This class can be extended to add additional menu items or behavior specific to the account section, providing a customizable menu system for various user-related actions.
Properties
Declaration
Description
Entity
Declaration
Description
Specification
Declaration
Description
Sortable
Methods
Declaration
MagicObject $entity,
PicoSpecification|null $specification = null,
PicoSortable|null $sortable = null
)
{
}
Description
Constructor
Initializes the BasicMenu with the specified entity, specification, and sortable options.
Parameters
The entity to be used for data loading.
Optional. The specification
Optional. The sortable options for
Declaration
{
}
Description
Load data
Loads data from the entity based on the provided specification and sorting options.
Return
The loaded data.
Declaration
PicoPageData $data,
callable $callbackFunction
) : string|null
{
}
Description
Render menu
Renders the menu using the provided callback function on the given data.
Parameters
The data to be rendered.
The function to be called for rendering.
Return
The rendered output, or null if the callback is not callable.
Declaration
callable $callbackFunction
) : string|null
{
}
Description
Load and render menu
Combines loading and rendering the menu in a single method call.
Parameters
The function to be called for rendering.
Return
The rendered output from the callback function.
MagicApp\Menu\BasicMenu
Declaration
Package
MagicApp\MenuAuthors
- Kamshory
Links
Description
Class BasicMenu
Represents a basic menu structure that loads and renders data for the menu using an entity,
a specification (for filtering), and sortable options (for ordering). It provides functionality
to load data from a database or other entity, apply specifications and sorting, and render the data
using a callback function. The BasicMenu class can be extended or customized to cater to various
menu structures in an application.
Properties
Declaration
Description
Entity
Declaration
Description
Specification
Declaration
Description
Sortable
Methods
Declaration
MagicObject $entity,
PicoSpecification|null $specification = null,
PicoSortable|null $sortable = null
)
{
}
Description
Constructor
Initializes the BasicMenu with the specified entity, specification, and sortable options.
Parameters
The entity to be used for data loading.
Optional. The specification
Optional. The sortable options for
Declaration
{
}
Description
Load data
Loads data from the entity based on the provided specification and sorting options.
Return
The loaded data.
Declaration
PicoPageData $data,
callable $callbackFunction
) : string|null
{
}
Description
Render menu
Renders the menu using the provided callback function on the given data.
Parameters
The data to be rendered.
The function to be called for rendering.
Return
The rendered output, or null if the callback is not callable.
Declaration
callable $callbackFunction
) : string|null
{
}
Description
Load and render menu
Combines loading and rendering the menu in a single method call.
Parameters
The function to be called for rendering.
Return
The rendered output from the callback function.
MagicApp\Menu\MainMenu
Declaration
Package
MagicApp\MenuAuthors
- Kamshory
Links
Description
Class MainMenu
Represents the main menu structure that organizes a list of menu items
into groups based on specified column names. It extends the BasicMenu class
and provides functionality for organizing menu items into logical groups,
such as grouping by menu category or other criteria.
This class also supports associating each menu group with a unique identifier and allows for easy retrieval of the grouped menu structure. It is designed to be used in scenarios where menus need to be structured dynamically and grouped based on data stored in an entity or database.
Properties
Declaration
Description
Menu structure
Declaration
Description
Column name for menu group
Declaration
Description
Join column name for menu group
Declaration
Description
Entity
Declaration
Description
Specification
Declaration
Description
Sortable
Methods
Declaration
MagicObject[] $menu,
string $columnName,
string $joinColumnName
)
{
}
Description
Construct menu
Initializes the MainMenu with a list of menu items, organizing them into groups based on the specified column names.
Parameters
An array of menu items (MagicObject instances).
The column name used to group the menu items.
The column name used for joining menu groups.
Declaration
{
}
Description
Get menu
Returns the organized menu structure.
Return
The organized menu structure grouped by specified column.
Declaration
{
}
Description
Load data
Loads data from the entity based on the provided specification and sorting options.
Return
The loaded data.
Declaration
PicoPageData $data,
callable $callbackFunction
) : string|null
{
}
Description
Render menu
Renders the menu using the provided callback function on the given data.
Parameters
The data to be rendered.
The function to be called for rendering.
Return
The rendered output, or null if the callback is not callable.
Declaration
callable $callbackFunction
) : string|null
{
}
Description
Load and render menu
Combines loading and rendering the menu in a single method call.
Parameters
The function to be called for rendering.
Return
The rendered output from the callback function.
MagicApp\Menu\MessageMenu
Declaration
Package
MagicApp\MenuAuthors
- Kamshory
Links
Description
Class MessageMenu
Represents a menu for displaying and managing messages within the application.
It extends the BasicMenu class and inherits its functionality to load,
render, and display menu items. The MessageMenu class can be customized
for use cases that specifically require the display of messages, such as
user notifications or messaging systems.
Properties
Declaration
Description
Entity
Declaration
Description
Specification
Declaration
Description
Sortable
Methods
Declaration
MagicObject $entity,
PicoSpecification|null $specification = null,
PicoSortable|null $sortable = null
)
{
}
Description
Constructor
Initializes the BasicMenu with the specified entity, specification, and sortable options.
Parameters
The entity to be used for data loading.
Optional. The specification
Optional. The sortable options for
Declaration
{
}
Description
Load data
Loads data from the entity based on the provided specification and sorting options.
Return
The loaded data.
Declaration
PicoPageData $data,
callable $callbackFunction
) : string|null
{
}
Description
Render menu
Renders the menu using the provided callback function on the given data.
Parameters
The data to be rendered.
The function to be called for rendering.
Return
The rendered output, or null if the callback is not callable.
Declaration
callable $callbackFunction
) : string|null
{
}
Description
Load and render menu
Combines loading and rendering the menu in a single method call.
Parameters
The function to be called for rendering.
Return
The rendered output from the callback function.
MagicApp\Menu\MotificationMenu
Declaration
Package
MagicApp\MenuAuthors
- Kamshory
Links
Description
Class MotificationMenu
Represents a menu for displaying and managing notifications within the application.
It extends the BasicMenu class, which provides the core functionality to load,
render, and display menu items. The MotificationMenu class can be used to present
notification data, such as system alerts, user notifications, or event-based messages.
Properties
Declaration
Description
Entity
Declaration
Description
Specification
Declaration
Description
Sortable
Methods
Declaration
MagicObject $entity,
PicoSpecification|null $specification = null,
PicoSortable|null $sortable = null
)
{
}
Description
Constructor
Initializes the BasicMenu with the specified entity, specification, and sortable options.
Parameters
The entity to be used for data loading.
Optional. The specification
Optional. The sortable options for
Declaration
{
}
Description
Load data
Loads data from the entity based on the provided specification and sorting options.
Return
The loaded data.
Declaration
PicoPageData $data,
callable $callbackFunction
) : string|null
{
}
Description
Render menu
Renders the menu using the provided callback function on the given data.
Parameters
The data to be rendered.
The function to be called for rendering.
Return
The rendered output, or null if the callback is not callable.
Declaration
callable $callbackFunction
) : string|null
{
}
Description
Load and render menu
Combines loading and rendering the menu in a single method call.
Parameters
The function to be called for rendering.
Return
The rendered output from the callback function.
MagicApp\Utility\CloudflareUtil
Declaration
Description
Class CloudflareUtil
A utility class for handling Cloudflare-related operations, specifically for managing IP addresses. This class provides methods to retrieve the client's real IP address when using Cloudflare and to validate IP addresses against known Cloudflare IP ranges.
Properties
Declaration
Description
@var array IP ranges belonging to Cloudflare.
Methods
Declaration
bool $validateRequest = false
) : string
{
}
Description
Get the client's real IP address.
This method retrieves the real IP address of the client using the CF-Connecting-IP header provided by Cloudflare. If the header is not present or the request is not validated, it falls back to using the REMOTE_ADDR server variable.
Parameters
Optional. If true, validates that the
Return
The client's IP address.
Declaration
string $ip,
string $range
) : bool
{
}
Description
Check if an IP address is within a specified range.
This method determines whether a given IP address falls within a specified IP range, which can be in CIDR format or a custom range.
Parameters
The IP address to check.
The IP range in CIDR or custom format.
Return
True if the IP is in the range, false otherwise.
Declaration
string $ip,
string $range
) : bool
{
}
Description
Determine if an IP address is within a CIDR range.
Parameters
The IP address to check.
The CIDR range (e.g., '192.168.1.0/24').
Return
True if the IP is in the CIDR range, false otherwise.
Declaration
string $ip,
string $range
) : bool
{
}
Description
Determine if an IP address is within a non-CIDR range.
Parameters
The IP address to check.
The range in custom format (e.g., '192.168.1.*' or '192.168.1.0-192.168.1.255').
Return
True if the IP is in the range, false otherwise.
MagicApp\Utility\PeriodUtil
Declaration
Description
Class PeriodUtil
Utility class for handling period calculations based on a specific format. This class provides methods to calculate the next and previous periods given a current period in 'YYYYMM' format, allowing for easy date manipulation in applications that require monthly period handling.
Methods
Declaration
string $currentPeriod,
int $n
) : string
{
}
Description
Get the next period by adding a specified number of months.
This method takes the current period as a string in 'YYYYMM' format and adds a specified number of months to it, returning the resulting period also in 'YYYYMM' format. It handles year rollover when necessary.
Parameters
The current period in 'YYYYMM' format.
The number of months to add.
Return
The next period in 'YYYYMM' format.
Declaration
string $currentPeriod,
int $n
) : string
{
}
Description
Get the previous period by subtracting a specified number of months.
This method takes the current period as a string in 'YYYYMM' format and subtracts a specified number of months from it, returning the resulting period also in 'YYYYMM' format. It handles year rollover when subtracting, ensuring valid output.
Parameters
The current period in 'YYYYMM' format.
The number of months to subtract.
Return
The previous period in 'YYYYMM' format.
MagicApp\Utility\ZipDownloader
Declaration
Description
A utility class for creating and downloading ZIP files in PHP.
This class provides methods to compress files or directories into a ZIP archive and offer it as a downloadable file. It includes functionality for:
- Zipping all files in a directory recursively.
- Zipping an array of specified file paths.
-
Handling temporary file creation and cleanup.
Example Use Cases:
- Provide downloadable backups of folders.
-
Compress selected files into a single archive for sharing.
Example
<?php try { $folderPath = 'path/to'; ZipDownloader::downloadFolderAsZip($folderPath, 'my-files.zip'); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }or
<?php try { $files = [ 'path/to/file1.txt', 'path/to/file2.jpg', 'path/to/file3.pdf' ]; ZipDownloader::downloadFilesAsZip($files, 'my-files.zip'); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }Features:
- Automatically handles folder structures in ZIP files.
- Validates file paths and directories before processing.
- Integrates seamless ZIP file download via HTTP headers.
Constants
Methods
Declaration
string $folderPath,
string $zipFileName
)
{
}
Description
Create a ZIP file from a folder and download it.
Parameters
Path to the folder containing files to include in the ZIP.
Name of the ZIP file to create.
Throws
If the folder doesn't exist or can't create the ZIP file.
Declaration
string[] $filePaths,
string $zipFileName
)
{
}
Description
Create a ZIP file from an array of file paths and download it.
Parameters
Array of file paths to include in the ZIP.
Name of the ZIP file to create.
Throws
If a file path is invalid or the ZIP cannot be created.
Declaration
array $filePaths,
string $zipFileName
)
{
}
Description
Create a ZIP file from an associated array of file paths and download it.
Parameters
Associative array of file paths and their human-readable names.
Name of the ZIP file to create.
Throws
If a file path is invalid or the ZIP cannot be created.
Declaration
string $folderPath,
ZipArchive $zip,
string $basePath = ''
)
{
}
Description
Recursively add files and folders to a ZIP archive.
Parameters
Path to the folder.
ZipArchive object.
Base path for relative paths in the ZIP.
Declaration
string $zipFilePath,
string $zipFileName
)
{
}
Description
Send the generated ZIP file to the client for download and clean up.
Parameters
Path to the ZIP file on the server.
Name of the ZIP file for the download.
MagicApp\XLSX\CSVDocumentWriter
Declaration
Description
Class CSVDocumentWriter
Responsible for generating CSV documents from provided page data. This class extends DocumentWriter and implements methods to write data in CSV format, including handling headers and utilizing custom writer functions for formatted data output.
Properties
Declaration
Description
Header format
Declaration
Description
Application language
Methods
Declaration
PicoPageData $pageData,
string $fileName,
string $sheetName,
string[] $headerFormat,
callable $writerFunction,
boolean $useTemporary = true
) : self
{
}
Description
Write data to a CSV file and prepare for download
Parameters
Page data
File name for the download
Sheet name (not used in CSV)
Data format for headers
Function to write formatted data
Flag to use temporary file
Return
The current instance, allowing method chaining
Declaration
PicoPageData $pageData
) : void
{
}
Description
Write data without specific format
Parameters
Page data
Return
Declaration
string[] $keys
) : self
{
}
Description
Write header format to the CSV
Parameters
Data keys
Return
The current instance, allowing method chaining
Declaration
string[] $keys,
MagicObject $row
) : self
{
}
Description
Write a single row of data to the CSV
Parameters
Data keys
Data row
Return
The current instance, allowing method chaining
Declaration
PicoPageData $pageData,
string[] $headerFormat,
callable $writerFunction
) : void
{
}
Description
Write data using the provided format
Parameters
Page data
Data format
Writer function for formatted data
Return
Declaration
array $data
) : self
{
}
Description
Write a line of data to the CSV
Parameters
Array of values to write
Return
The current instance, allowing method chaining
Declaration
resource $handle,
mixed[] $fields,
string $delimiter = ',',
string $enclosure = '"',
string $escape_char = '\\',
string $record_separator = ' '
) : self
{
}
Description
Custom implementation of fputcsv
Parameters
File handle
Array of values to write
Field delimiter
Field enclosures
Escape enclosure characters in fields
Record separator
Return
The current instance, allowing method chaining
Declaration
AppLanguage $appLanguage
)
{
}
Description
Constructor
Parameters
Application language instance
Declaration
PicoPageData $pageData
) : bool
{
}
Description
Check if no data has been fetched
Parameters
Page data
Return
True if no data has been fetched, false otherwise
Declaration
{
}
Description
Get the application language
Return
The current application language
Declaration
AppLanguage $appLanguage
) : DocumentWriter
{
}
Description
Set the application language
Parameters
Application language
Return
Declaration
AppLanguage $appLanguage
) : XLSXDocumentWriter
{
}
Description
Create an instance of XLSXDocumentWriter
Parameters
Application language
Return
An instance of XLSXDocumentWriter
Declaration
AppLanguage $appLanguage
) : CSVDocumentWriter
{
}
Description
Create an instance of CSVDocumentWriter
Parameters
Application language
Return
An instance of CSVDocumentWriter
MagicApp\XLSX\DocumentWriter
Declaration
Description
Class DocumentWriter
Abstract class for writing documents in different formats (e.g., XLSX, CSV). It provides methods for setting and retrieving application language and for checking data fetching options. Specific document writing logic should be implemented in subclasses such as XLSXDocumentWriter and CSVDocumentWriter.
Properties
Declaration
Description
Header format
Declaration
Description
Application language
Methods
Declaration
AppLanguage $appLanguage
)
{
}
Description
Constructor
Parameters
Application language instance
Declaration
PicoPageData $pageData
) : bool
{
}
Description
Check if no data has been fetched
Parameters
Page data
Return
True if no data has been fetched, false otherwise
Declaration
{
}
Description
Get the application language
Return
The current application language
Declaration
AppLanguage $appLanguage
) : DocumentWriter
{
}
Description
Set the application language
Parameters
Application language
Return
Declaration
AppLanguage $appLanguage
) : XLSXDocumentWriter
{
}
Description
Create an instance of XLSXDocumentWriter
Parameters
Application language
Return
An instance of XLSXDocumentWriter
Declaration
AppLanguage $appLanguage
) : CSVDocumentWriter
{
}
Description
Create an instance of CSVDocumentWriter
Parameters
Application language
Return
An instance of CSVDocumentWriter
MagicApp\XLSX\IOException
Declaration
Description
Class IOException
Custom exception class for handling input/output errors.
Properties
Declaration
Description
Previous exception that led to this exception
Methods
Declaration
string $message,
int $code = 0,
Throwable|null $previous = null
)
{
}
Description
IOException constructor.
Parameters
Exception message
Exception code
Previous exception
Declaration
{
}
Description
Get the previous exception
Return
MagicApp\XLSX\XLSXBuffererWriter
Declaration
Description
Class XLSXBuffererWriter
This class is responsible for writing data to an XLSX file in a buffered manner. It manages a write buffer to optimize file operations, flushing data to the underlying file resource when the buffer reaches a certain size. The class also includes functionality to validate UTF-8 encoding for the data being written.
Properties
Declaration
Description
Resource to file
Declaration
Description
Buffer
Declaration
Description
Flag to check UTF-8 encoding
Methods
Declaration
string $filename,
string $fd_fopen_flags = 'w',
boolean $checkUtf8 = false
)
{
}
Description
Constructor
Parameters
File name
Open file flag
Flag to check UTF-8 encoding
Declaration
string $string
) : self
{
}
Description
Write to buffer
Parameters
Data to write
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Purge the buffer, writing its contents to the file
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Close the file and flush any remaining buffer
Return
The current instance, allowing method chaining
Declaration
{
}
Description
Destructor
Automatically closes the file when the object is destroyed
Declaration
{
}
Description
Returns the current position of the file read/write pointer
Return
Current file position or -1 on error
Declaration
integer $pos
) : integer
{
}
Description
Seeks on a file pointer
Parameters
Position to seek to
Return
0 on success, -1 on failure
Declaration
string $string
) : boolean
{
}
Description
Validate UTF-8 encoding of a string
Parameters
String to validate
Return
True if valid UTF-8, false otherwise
MagicApp\XLSX\XLSXDataFormat
Declaration
Description
Class XLSXDataFormat
This class is responsible for defining the data format for columns in an XLSX file based on a given entity. It maps the entity's properties to Excel-compatible data types, allowing for precision settings for numeric values. It dynamically generates getter methods for accessing formatted data types based on the entity's schema.
Properties
Declaration
Description
Columns
Declaration
Description
Precision
Methods
Declaration
MagicObject $entity,
integer|null $precision = null
)
{
}
Description
Constructor
Parameters
The entity to map
The precision for numeric values
Declaration
string $name,
array $arguments
) : mixed|null|void
{
}
Description
Magic method for dynamic getter methods
Parameters
Method name
Method arguments
Return
Declaration
string $type
) : XLSXDataType
{
}
Description
Convert to Excel type
Parameters
The type to convert
Return
MagicApp\XLSX\XLSXDataType
Declaration
Description
Class XLSXDataType
This class defines various data types that can be used in an XLSX file. It maps database column types to Excel data types, handling conversions and precision for numeric values. The class provides methods for determining the appropriate Excel format based on the column type and allows for customized number formatting.
Constants
Properties
Declaration
Description
Column type
Declaration
Description
Type map for MySQL, PostgreSQL, and SQLite
Declaration
Description
Precision
Methods
Declaration
string $columnType,
integer|null $precision = null
)
{
}
Description
Constructor
Parameters
Column type
Precision
Declaration
{
}
Description
Convert to Excel type
Return
Declaration
mixed $precision
) : string
{
}
Description
Get number format based on precision
Parameters
Precision
Return
Declaration
{
}
Description
Convert to string representation
Return
Declaration
{
}
Description
Convert to string representation
Return
MagicApp\XLSX\XLSXDocumentWriter
Declaration
Description
Class XLSXDocumentWriter
This class is responsible for writing data to an XLSX document. It handles both formatted and unformatted data and manages the creation of the sheet headers and rows based on the provided data.
Properties
Declaration
Description
Header format
Declaration
Description
Application language
Methods
Declaration
PicoPageData $pageData,
string $fileName,
string $sheetName,
array $headerFormat,
callable $writerFunction,
bool $useTemporary = true
) : self
{
}
Description
Write data to an XLSX file
Parameters
Page data to write
File name for the output
Name of the sheet to create
Data format for the header
Function to format data
Whether to use a temporary file
Return
The current instance, allowing method chaining
Declaration
XLSXWriter $writer,
PicoPageData $pageData,
string $sheetName
) : XLSXWriter
{
}
Description
Write data without specific formatting
Parameters
XLSX writer instance
Page data to write
Name of the sheet
Return
Declaration
XLSXWriter $writer,
string $sheetName,
array $keys
) : XLSXWriter
{
}
Description
Write the header row to the XLSX sheet
Parameters
XLSX writer instance
Name of the sheet
Data keys for the header
Return
Declaration
XLSXWriter $writer,
string $sheetName,
array $keys,
MagicObject $row
) : XLSXWriter
{
}
Description
Write a data row to the XLSX sheet
Parameters
XLSX writer instance
Name of the sheet
Data keys
Data row to write
Return
Declaration
XLSXWriter $writer,
PicoPageData $pageData,
string $sheetName,
array $headerFormat,
callable $writerFunction
) : XLSXWriter
{
}
Description
Write data with specific formatting
Parameters
XLSX writer instance
Page data to write
Name of the sheet
Data format for the header
Function to format data
Return
Declaration
AppLanguage $appLanguage
)
{
}
Description
Constructor
Parameters
Application language instance
Declaration
PicoPageData $pageData
) : bool
{
}
Description
Check if no data has been fetched
Parameters
Page data
Return
True if no data has been fetched, false otherwise
Declaration
{
}
Description
Get the application language
Return
The current application language
Declaration
AppLanguage $appLanguage
) : DocumentWriter
{
}
Description
Set the application language
Parameters
Application language
Return
Declaration
AppLanguage $appLanguage
) : XLSXDocumentWriter
{
}
Description
Create an instance of XLSXDocumentWriter
Parameters
Application language
Return
An instance of XLSXDocumentWriter
Declaration
AppLanguage $appLanguage
) : CSVDocumentWriter
{
}
Description
Create an instance of CSVDocumentWriter
Parameters
Application language
Return
An instance of CSVDocumentWriter
MagicApp\XLSX\XLSXWriter
Declaration
Constants
Properties
Declaration
Description
@var string $title The title of the document.
Declaration
Description
@var string $subject The subject of the document.
Declaration
Description
@var string $author The author of the document.
Declaration
Description
@var bool $isRightToLeft Flag indicating whether the document is right-to-left.
Declaration
Description
@var string $company The company associated with the document.
Declaration
Description
@var string $description A description of the document.
Declaration
Description
@var array $keywords Keywords related to the document for search purposes.
Declaration
Description
@var mixed $current_sheet Reference to the currently active sheet.
Declaration
Description
@var array $sheets List of all sheets within the document.
Declaration
Description
@var array $temp_files Array holding temporary file paths.
Declaration
Description
@var array $cell_styles Array holding the cell styles used in the document.
Declaration
Description
@var array $number_formats Array of custom number formats used within the document.
Declaration
Description
@var string $tempdir Temporary directory path used for intermediate files.
Methods
Declaration
{
}
Description
Class Constructor
Initializes the class by defining constants, setting the default timezone,
validating the write permissions for the temporary directory, and checking
for required dependencies such as the ZipArchive class. Also initializes
a default cell style.
Declaration
string $title = ''
) : self
{
}
Description
Set the title of the document.
Parameters
The title to set.
Return
The current instance, allowing method chaining.
Declaration
string $subject = ''
) : self
{
}
Description
Set the subject of the document.
Parameters
The subject to set.
Return
The current instance, allowing method chaining.
Declaration
string $author = ''
) : self
{
}
Description
Set the author of the document.
Parameters
The author to set.
Return
The current instance, allowing method chaining.
Declaration
string $company = ''
) : self
{
}
Description
Set the company name associated with the document.
Parameters
The company name to set.
Return
The current instance, allowing method chaining.
Declaration
string $keywords = ''
) : self
{
}
Description
Set the keywords associated with the document.
Parameters
The keywords to set.
Return
The current instance, allowing method chaining.
Declaration
string $description = ''
) : self
{
}
Description
Set the description of the document.
Parameters
The description to set.
Return
The current instance, allowing method chaining.
Declaration
string $tempdir = ''
) : self
{
}
Description
Set the directory for temporary files.
Parameters
The temporary directory to use.
Return
The current instance, allowing method chaining.
Declaration
bool $isRightToLeft = false
) : self
{
}
Description
Enable or disable right-to-left text direction.
Parameters
Whether to set right-to-left text direction (default: false).
Return
The current instance, allowing method chaining.
Declaration
{
}
Description
Class Destructor
Cleans up temporary files created during the instance's lifetime by
attempting to delete each file in the $temp_files array.
Declaration
{
}
Description
Generate a temporary file name.
Creates a temporary file in the specified temporary directory or the system's default temporary directory. If the file cannot be created, it throws an exception indicating a possible issue with open file handles.
Return
The full path of the created temporary file.
Throws
If the temporary file cannot be created.
Declaration
{
}
Description
Writes the contents of the current sheets to stdout.
Return
The current instance, allowing method chaining.
Declaration
{
}
Description
Writes the contents of the current sheets to a string.
Return
The contents of the file as a string.
Declaration
string $filename
)
{
}
Description
Writes the current sheets to a specified file.
Parameters
The filename to write the contents to.
Declaration
string $sheet_name,
array $col_widths = array ( ),
bool $auto_filter = false,
bool $freeze_rows = false,
bool $freeze_columns = false
)
{
}
Description
Initializes a new sheet with the specified properties.
Parameters
The name of the sheet to initialize.
Optional array of column widths.
Whether to enable auto-filtering.
Number of rows to freeze.
Number of columns to freeze.
Declaration
string $number_format,
string|null $cell_style_string
) : int
{
}
Description
Adds a cell style and returns its index.
Parameters
The number format to apply.
Optional style string.
Return
Index of the cell style.
Declaration
array $header_types
) : array
{
}
Description
Initializes column types based on the provided header types.
Parameters
An array of header types (e.g., 'string', 'date', etc.).
Return
Returns an array of column type definitions, including number format, type, and default cell style.
Declaration
string $sheet_name,
array $header_types,
array|null $col_options = null
) : void
{
}
Description
Writes the header row to the specified sheet and initializes its column types.
Parameters
The name of the sheet to write to.
An associative array defining column headers and their types.
Optional settings for the columns, such as widths, auto-filter, and freeze options.
Return
Declaration
string $sheet_name,
array $row,
array|null $row_options = null
) : void
{
}
Description
Writes a data row to the specified sheet.
Parameters
The name of the sheet to write to.
An array containing the values for the row.
Optional settings for the row, such as height, hidden, or collapsed state.
Return
Declaration
string $sheet_name = ''
) : int
{
}
Description
Counts the number of rows in a specified sheet.
Parameters
The name of the sheet to count rows for. Defaults to the current sheet.
Return
The number of rows in the sheet.
Declaration
string $sheet_name
) : void
{
}
Description
Finalizes a sheet by writing the necessary closing tags and metadata.
Parameters
The name of the sheet to finalize.
Return
Declaration
string $sheet_name,
int $start_cell_row,
int $start_cell_column,
int $end_cell_row,
int $end_cell_column
) : void
{
}
Description
Marks a range of cells as merged in the specified sheet.
Parameters
The name of the sheet.
The starting row of the merged range.
The starting column of the merged range.
The ending row of the merged range.
The ending column of the merged range.
Return
Declaration
array $data,
string $sheet_name = '',
array $header_types = array ( )
) : void
{
}
Description
Writes an entire sheet with the provided data, header, and optional sheet name.
Parameters
The data to write to the sheet.
The name of the sheet. Defaults to 'Sheet1' if not provided.
An optional associative array for defining column headers and their types.
Return
Declaration
XLSXBuffererWriter $file,
int $row_number,
int $column_number,
mixed $value,
string $num_format_type,
int $cell_style_idx
) : void
{
}
Description
Writes a cell to the specified sheet file with the given value and style.
Parameters
The file writer object for the sheet.
The row number where the cell will be written.
The column number where the cell will be written.
The value of the cell.
The number format type of the cell (e.g., 'n_string', 'n_date').
The index of the cell's style.
Return
Declaration
{
}
Description
Generates font and style indexes based on cell styles.
This function processes a collection of cell styles, extracting relevant font, border, and fill properties to create the necessary indexes for each style. It then returns the corresponding font, fill, and border definitions along with the final style index mappings. This method is primarily used to handle Excel cell styles and create appropriate references for the styles used in the spreadsheet.
Return
An array containing:
Declaration
{
}
Description
Generates the XML content for the styles of an Excel spreadsheet (XLSX format).
This method creates the styles.xml file which contains information about fonts,
fills, borders, and cell styles used in the workbook. It writes the XML data to
a temporary file and returns the filename.
The XML structure includes:
- Number Formats
- Fonts
- Fills
- Borders
- Cell Styles
- Cell StyleXfs
- Cell Xfs
Return
The temporary filename where the generated styles.xml is stored.
Declaration
{
}
Description
Generates the XML content for the application properties of an Excel spreadsheet (XLSX format).
This method creates the app.xml file which contains extended properties for the workbook,
including the total time spent, company name, and other metadata.
The XML structure includes:
- TotalTime (set to 0)
- Company name (escaped with
xmlspecialchars)
Return
The XML content representing the application properties for the workbook.
Declaration
{
}
Description
Generates the XML content for the core properties of an Excel spreadsheet (XLSX format).
This method creates the core.xml file which contains core metadata for the workbook,
such as the creation date, title, subject, creator, keywords, description, and revision number.
The XML structure includes:
- Created date (formatted in W3CDTF)
- Title
- Subject
- Creator (author)
- Keywords (optional, if provided)
- Description
- Revision number (set to 0)
Return
The XML content representing the core properties for the workbook.
Declaration
{
}
Description
Generates the XML content for the relationships of an Excel spreadsheet (XLSX format).
This method creates the rels.xml file, which defines the relationships between the
main workbook file and other associated files, such as the core properties and
extended properties.
The XML structure includes:
- Relationship with the workbook (
rId1) - Relationship with the core properties (
rId2) - Relationship with the extended properties (
rId3)
Return
The XML content representing the relationships for the workbook.
Declaration
{
}
Description
Generates the XML content for the workbook part of an Excel spreadsheet (XLSX format).
This method creates the workbook.xml file, which contains the workbook's metadata
and structure, such as sheet details, defined names (e.g., for auto-filter ranges),
and workbook-level properties.
The XML structure includes:
- File version information (e.g., app name)
- Workbook properties (e.g., backup file, date1904)
- Views and layout settings for the workbook
- Sheet definitions (e.g., sheet names, IDs, and relationships)
- Defined names (e.g., for auto-filter ranges)
- Calculation properties (e.g., iteration settings)
Return
The XML content representing the workbook part of the XLSX file.
Declaration
{
}
Description
Generates the XML content for the workbook relationships part of an Excel spreadsheet (XLSX format).
This method creates the workbook.xml.rels file, which defines the relationships between
the workbook and other parts of the document such as worksheets and styles.
The XML structure includes:
- Relationship to the styles.xml file
-
Relationships to each worksheet, based on the sheets in the workbook
The relationships are represented with unique IDs and specify the target files for each relationship.
Return
The XML content representing the workbook relationships part of the XLSX file.
Declaration
{
}
Description
Generates the XML content for the content types part of an Excel spreadsheet (XLSX format).
This method creates the [Content_Types].xml file, which specifies the content types for each part
of the spreadsheet package. This includes the types for various XML files, relationships, and other parts
of the document, ensuring that each part is correctly identified by its MIME type.
The XML structure includes:
- Overrides for each part (such as worksheets, styles, and core properties) with specific content types.
- Content types are defined for the relationships file, the workbook file, worksheets, styles, and properties.
Return
The XML content representing the content types part of the XLSX file.
Declaration
int $row_number,
int $column_number,
bool $absolute = false
) : string
{
}
Description
Converts a row and column number into an Excel-style cell reference.
This function takes a zero-based row and column index and returns a corresponding cell reference in the format used by Excel (e.g., A1, C3, AA42). Optionally, it can return the reference as an absolute reference (e.g., $A$1, $C$3).
Parameters
The row number (zero-based index).
The column number (zero-based index).
Whether to return an absolute reference. If true, the result will include dollar signs
Return
The Excel-style cell reference, e.g., A1, C3, or $A$1, $C$3, depending on the value of $absolute.
Declaration
string|array $string
) : void
{
}
Description
Logs a string or an array to the error log with a timestamp.
This method logs a message to the error log with the current date and time (formatted as Y-m-d H:i:s).
If the provided input is an array, it is converted to a JSON string. Otherwise, the input string is logged directly.
A newline character is added at the end of each log entry.
Parameters
The message or data to log. If an array is passed, it will be converted to JSON.
Return
Declaration
string $filename
) : string
{
}
Description
Sanitize a filename to remove invalid or non-printable characters.
This method removes characters that are not allowed in filenames according to the Windows operating system
(as outlined in the MSDN documentation: http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx).
It eliminates non-printing characters (ASCII values 0-31) as well as other common invalid characters, such as
<, >, ?, ", :, |, \, /, *, and &.
Parameters
The filename to be sanitized.
Return
The sanitized filename with invalid characters removed.
Declaration
string $sheetname
) : string
{
}
Description
Sanitize a sheet name to ensure it is valid for use in a spreadsheet.
This method removes or replaces characters that are not allowed in sheet names (such as \, /, ?, *, :, [, and ])
and ensures the sheet name does not exceed the maximum length of 31 characters. It also trims any excess spaces and removes
surrounding single quotes. If the resulting sheet name is empty, a default name is generated.
Parameters
The input sheet name to be sanitized.
Return
The sanitized sheet name, ensuring it is valid and within the allowed length, or a default name if the input is invalid.
Declaration
string $val
) : string
{
}
Description
Convert special characters to HTML entities, with additional handling for bad characters.
This method is a customized version of htmlspecialchars that also replaces certain control characters
with spaces. The characters it replaces are typically considered invalid in XML and HTML, ensuring
that the resulting string is suitable for use in an XML document. This function improves the behavior
of htmlspecialchars by handling a broader set of invalid characters.
Parameters
The input string to be converted.
Return
The converted string with special characters replaced by their corresponding HTML entities
Declaration
array $arr
) : array|object|int|string|null
{
}
Description
Retrieve the first key of an array.
This method resets the internal pointer of the array and returns the key of the first element. It can be useful when you need to access the first key of an array without modifying its contents.
Parameters
The input array whose first key is to be retrieved.
Return
The key of the first element in the array. If the array is empty,
Declaration
string $num_format
) : string
{
}
Description
Determines the type of a number format based on a given format string.
This method analyzes the provided number format string and returns a corresponding format type. It supports a variety of number formats such as general, string, numeric, date, and datetime. It also handles formats with special characters like percentage (%), dollar sign ($), or time-related patterns. The method ignores certain color specifiers within square brackets (e.g., [Red], [Blue]) when performing the analysis.
Parameters
The number format string to analyze. This string can represent different
Return
The determined number format type. Possible return values include:
Declaration
string $num_format
) : string
{
}
Description
Standardizes a given number format string by mapping common format types to specific patterns. The function also escapes certain characters in the format string to ensure compatibility with formatting standards.
This method supports a variety of number formats such as "money", "number", "string", "integer", "date", "datetime", "time", "price", "dollar", and "euro", converting them into predefined formats. Additionally, it escapes special characters like spaces, dashes, parentheses, and square brackets to ensure proper handling.
Parameters
The number format type to standardize. Possible values include:
Return
The standardized number format string with special characters escaped.
Declaration
array $haystack,
mixed $needle
) : int
{
}
Description
Adds an item to an array if it is not already present and returns its index. If the item already exists in the array, its index is returned. If it doesn't exist, the item is appended to the array, and the new index is returned.
This method ensures that each unique item appears only once in the list and returns the index of the item (whether newly added or existing).
Parameters
The array to which the item should be added if not already present.
The item to search for and potentially add to the array.
Return
The index of the item in the array after the operation.
Declaration
string $date_input
) : float
{
}
Description
Converts a date-time string into the number of days since the Excel 1900 epoch (with time as a fraction of the day). This method handles Excel's unique date system, which uses January 1, 1900, as the start date, and incorrectly considers 1900 as a leap year. It also adjusts for special cases like the false leap day (1900-02-29).
The function parses the input date-time string and computes the total number of days since the Excel epoch, adjusting for leap years, leap days, and special cases where Excel's date system deviates from the Gregorian calendar.
Parameters
The date-time string in the format "YYYY-MM-DD HH:MM:SS".
Return
The number of days since the Excel 1900 epoch, with the time portion as a fraction of the day.